public ActionResult UpdateInventoryDone() { var info = _infoRepository.GetInfo(); info.InventoryLastUpdated = DateTime.UtcNow; _infoRepository.Update(info); return(Content("")); }
public IActionResult EditInfo(InfoEditViewModel model) { if (ModelState.IsValid) { AppInfo info = _infoRepository.GetInfo(model.Id = 1); info.AppName = model.AppName; info.AppAddress = model.AppAddress; info.AppPhone1 = model.AppPhone1; info.AppPhone2 = model.AppPhone2; info.AppDescription = model.AppDescription; info.AppEmail = model.AppEmail; if (model.AppImages != null) { if (model.ExistingImagePath != null) { string filePath = Path.Combine(_hostingEnvironment.WebRootPath, "images", model.ExistingImagePath); System.IO.File.Delete(filePath); } info.AppImage = ProcessUploadAppImage(model); } _infoRepository.Update(info); TempData["message"] = $"Application {model.AppName} data has been updated.."; return(RedirectToAction("Index")); } return(View()); }
public IActionResult EditInfo(InfoEditViewModel model) //отправляем обновленные данные о приложении в Базу Данных(Название, логотип, контакты и тд. приложения). { if (ModelState.IsValid) { Info info = _infoRepository.GetInfo(model.Id = 1); info.AppName = model.AppName; info.AppHomeImageText = model.AppHomeImageText; info.AppHomeImageTextFirst = model.AppHomeImageTextFirst; info.AppHomeImageTextSecond = model.AppHomeImageTextSecond; if (model.AppImages != null) //обновление изображения логотипа сайта. { if (model.ExistingImagePath != null) { string filePath = Path.Combine(_hostingEnvironment.WebRootPath, "images", model.ExistingImagePath); System.IO.File.Delete(filePath); } info.AppImage = ProcessUploadAppImage(model); } if (model.AppHomeImage != null) //обновление изображение домашней страницы. { if (model.ExistingAppHomeImage != null) { string filePath = Path.Combine(_hostingEnvironment.WebRootPath, "images", model.ExistingAppHomeImage); System.IO.File.Delete(filePath); } info.AppHomeImage = ProcessUploadAppHomeImage(model); } if (model.AppHomeImageFirst != null) //обновление изображение домашней страницы. { if (model.ExistingAppHomeImageFirst != null) { string filePath = Path.Combine(_hostingEnvironment.WebRootPath, "images", model.ExistingAppHomeImageFirst); System.IO.File.Delete(filePath); } info.AppHomeImageFirst = ProcessUploadAppHomeImageFirst(model); } if (model.AppHomeImageSecond != null) //обновление изображение домашней страницы. { if (model.ExistingAppHomeImageSecond != null) { string filePath = Path.Combine(_hostingEnvironment.WebRootPath, "images", model.ExistingAppHomeImageSecond); System.IO.File.Delete(filePath); } info.AppHomeImageSecond = ProcessUploadAppHomeImageSecond(model); } _infoRepository.Update(info); TempData["message"] = $"Информация о приложения {model.AppName} была отредактирована."; return(RedirectToAction("Index")); } return(View()); }
public int Run() { var startTime = DateTime.UtcNow; var colours = _colourService.GetAllColours(); var allResults = new List <(IEnumerable <string> errors, int count, string colour)>(); foreach (var colour in colours) { Console.WriteLine("Starting on colour: " + colour.Name); var result = _service.UpdateInventoryForColour(colour.Id); allResults.Add((result.errors, result.count, colour.Name)); } var info = _infoRepository.GetInfo(); info.InventoryLastUpdated = DateTime.UtcNow; _infoRepository.Update(info); SendEmail(allResults, startTime); Console.WriteLine("Done!"); return(0); }
public IActionResult OnPost() { if (ModelState.IsValid) { _infoRepository.Update(GeneralInfo); _infoRepository.Commit(); return(RedirectToPage("./Details", new { infoId = GeneralInfo.Id })); } return(Page()); }
public void Put(string id, [FromBody] Info info) { try { _logger.LogInfo("InfoController Put(string id, [FromBody]Info info)"); _infoRepository.Update(id, info); } catch (Exception ex) { _logger.LogError(ex.Message); throw; } }
public void Update(Info model) { var infos = _infoRepository.List().ToList(); if (!infos.Any()) { Add(model); } else { InfoDBEntity info = infos.FirstOrDefault(); info.Content = model.Content; _infoRepository.Update(info); } }
public IActionResult EditInfo(InfoEditViewModel model) //отправляем обновленные данные о приложении в Базу Данных(Название, логотип, контакты и тд. приложения). { if (ModelState.IsValid) { Info info = _infoRepository.GetInfo(model.Id = 1); info.AppName = model.AppName; info.AppAddress = model.AppAddress; info.AppPhone1 = model.AppPhone1; info.AppPhone2 = model.AppPhone2; info.AppSocialAddress = model.AppSocialAddress; info.AppEmail = model.AppEmail; info.AppHomeText = model.AppHomeText; info.AppHomeText2 = model.AppHomeText2; info.AppHomeSlideText1 = model.AppHomeSlideText1; info.AppHomeSlideText2 = model.AppHomeSlideText2; info.AppHomeSlideText3 = model.AppHomeSlideText3; if (model.AppImages != null) //обновление изображения логотипа сайта. { if (model.ExistingImagePath != null) { string filePath = Path.Combine(_hostingEnvironment.WebRootPath, "images", model.ExistingImagePath); System.IO.File.Delete(filePath); } info.AppImage = ProcessUploadAppImage(model); } if (model.AppSocialImgs != null) //обновление изображение социальной ссылки. { if (model.ExistingSocialImagePath != null) { string filePath = Path.Combine(_hostingEnvironment.WebRootPath, "images", model.ExistingSocialImagePath); System.IO.File.Delete(filePath); } info.AppSocialImg = ProcessUploadAppSocialImage(model); } if (model.AppBackgroundImages != null) //обновление изображение заднего фона приложения. { if (model.ExistingBackgroundImagePath != null) { string filePath = Path.Combine(_hostingEnvironment.WebRootPath, "images", model.ExistingBackgroundImagePath); System.IO.File.Delete(filePath); } info.AppBackgroundImage = ProcessUploadAppBackgroundImage(model); } if (model.AppHomeImages != null) //обновление изображение начальной страницы приложения. { if (model.ExistingAppHomeImagesPath != null) { string filePath = Path.Combine(_hostingEnvironment.WebRootPath, "images", model.ExistingAppHomeImagesPath); System.IO.File.Delete(filePath); } info.AppHomeImage = ProcessUploadAppHomeImage(model); } if (model.CarouselImage1 != null) { if (model.CarouselPhotoPath1 != null) { string filePath = Path.Combine(_hostingEnvironment.WebRootPath, "images", model.CarouselPhotoPath1); System.IO.File.Delete(filePath); } info.CarouselImage = ProcessUploadFile1(model); } if (model.CarouselImage2 != null) { if (model.CarouselPhotoPath2 != null) { string filePath = Path.Combine(_hostingEnvironment.WebRootPath, "images", model.CarouselPhotoPath2); System.IO.File.Delete(filePath); } info.CarouselImage2 = ProcessUploadFile2(model); } if (model.CarouselImage3 != null) { if (model.CarouselPhotoPath3 != null) { string filePath = Path.Combine(_hostingEnvironment.WebRootPath, "images", model.CarouselPhotoPath3); System.IO.File.Delete(filePath); } info.CarouselImage3 = ProcessUploadFile3(model); } _infoRepository.Update(info); TempData["message"] = $"Was {model.AppName} was edited."; return(RedirectToAction("Index")); } return(View()); }