public ActionResult PutDb(string path, Dispanser dispanser) { var repo = new Repo(); repo.WritePage(path, dispanser, User.Identity.Name); return new HttpStatusCodeResult(HttpStatusCode.OK); }
public void WritePage(string path, Dispanser dispanser, string userName) { var db = JsonConvert.DeserializeObject<Dispanser>(ReadDb()); if (dispanser.AboutUsPage != null) { db.AboutUsPage = dispanser.AboutUsPage; } if (dispanser.AdministrationPage != null) { db.AdministrationPage = dispanser.AdministrationPage; } if (dispanser.CareerPage != null) { db.CareerPage = dispanser.CareerPage; } if (dispanser.CatalogPage != null) { db.CatalogPage = dispanser.CatalogPage; } if (dispanser.SchedulePage != null) { db.SchedulePage = dispanser.SchedulePage; } if (dispanser.HomePage != null) { db.HomePage = dispanser.HomePage; } WriteDb(JsonConvert.SerializeObject(db, new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }), userName); }