Posts

Showing posts with the label asp.net-core-mvc

Convert Json to String Arrays

Convert Json to String Arrays This is my code for my form: product name: product detail: <button id="btn" type="submit" class="btn btn-default">Submit</button> This is my javascript $(function postProduct() { $('#btn').click(function () { var productName = document.getElementById("name").value; var productDetail = document.getElementById("detail").value; var dimensions = [ productName, productDetail]; var keys = $.map(dimensions, function (value, key) { return key; }); if (productName == '' || productDetail == '') { alert("Please Fill All Fields"); } else { $.ajax({ type: 'post', url: "api/product/addproduct", data: keys, dataType: 'j...

Reloading Options with reloadOnChange in ASP.NET Core

Reloading Options with reloadOnChange in ASP.NET Core In my ASP.NET Core application I bind the appsettings.json to a strongly typed class AppSettings . public Startup(IHostingEnvironment environment) { var builder = new ConfigurationBuilder() .SetBasePath(environment.ContentRootPath) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile($"appsettings.{environment.EnvironmentName}.json", optional: true, reloadOnChange: true) .AddEnvironmentVariables(); Configuration = builder.Build(); } public void ConfigureServices(IServiceCollection services) { services.Configure<AppSettings>(Configuration); //... } In a singleton class I wrap this AppSettings class like this: public class AppSettingsWrapper : IAppSettingsWrapper { private readonly IOptions<AppSettings> _options; public AppSettingsAdapter(IOptions<AppSettings> options) { _options = options ?? throw n...

Using a view as Create and Detail Method, Organize TimeLine

Image
Using a view as Create and Detail Method, Organize TimeLine What I'm trying to do: I'm trying to Add to the Candidate history (Description and Title, and DateTime.Now), Here is a image representation of what I want and what I managed to do: Also how can I add to the timeline to the left side when the select option is " candidate ", and right side when it's " Hitachi ", the property for that is adding timeline-Inverted to the <li> Class . timeline-Inverted <li> Class What I have now: @model HCCBPOHR.Data.Candidate @{ ViewData["Title"] = "CandidateHistory"; } <h2>Canidate - @Model.Name</h2> <label>History</label> <hr /> History Of @Model.Name @* *@ @*Isto é para inverter o lado*@ Title @Model.DateOfDescription.ToShor...