public async Task <Response> UpdateAuthor(UpdateAuthorRequest request) { var response = new Response(); var UpdateToMake = new Author() { Name = request.Name, Sex = request.Sex, Address = request.Address, BirthDate = request.BirthDate }; var result = await _repositoryCommand.Update(UpdateToMake); response.Data = result; return(response); }
public async Task <Response> UpdateABook(UpdateBookRequest book) { Response response = new Response(); Book books = new Book() { Id = book.Id, Name = book.Name, Author = book.Author, ISBN = book.ISBN }; var result = await _repositoryCommand.Update(books); response.Data = result; return(response); }
public void Execute() { try { List <EmailLog> emaillogmodellist = _emailJobQuery.GetAllList(m => m.IsSent == false && m.DateToSend <= DateTime.Now).Take(10).ToList(); if (emaillogmodellist.Any()) { foreach (EmailLog emaillogmodel in emaillogmodellist) { try { MailMessage msg = GenerateMail(emaillogmodel); bool result = Utilities.EmailHandler.Send(msg); if (result) { emaillogmodel.DateSent = DateTime.Now; emaillogmodel.IsSent = true; } else { emaillogmodel.IsSent = false; emaillogmodel.Retires++; } _emailJobCommand.Update(emaillogmodel); _emailJobCommand.SaveChanges(); } catch (Exception) { throw; } } } } catch (Exception ex) { _log.Info(ex); throw; } }
public ActionResult FrameworkSetting(FrameworkSetupViewModel model, string nextButton, string backButton) { ModelState.Clear(); _activityRepo.CreateActivityLog("In Framework setting currentconfig", this.ControllerContext.ActionDescriptor.ControllerName, this.ControllerContext.ActionDescriptor.ActionName, 0, null); if (backButton != null) { return(RedirectToAction("CurrentConfig")); } if (nextButton != null) { if (!ModelState.IsValid) { return(View(_setupContract)); } if (string.IsNullOrEmpty(model.PortalSetting.PortalTitle)) { ModelState.AddModelError("", "Portal title is required"); return(View(_setupContract)); } var app = new Application { ApplicationName = model.PortalSetting.PortalTitle, Description = model.PortalSetting.PortalDescription, TermsAndConditions = model.PortalSetting.TermsAndConditionPath, HasAdminUserConfigured = false }; if (_applicationQuery.GetAll().Any()) { Application datamodel = _applicationQuery.GetAll().FirstOrDefault(); app.Id = datamodel.Id; datamodel.ApplicationName = app.ApplicationName; datamodel.Description = app.Description; datamodel.TermsAndConditions = app.TermsAndConditions; _applicationCommand.Update(datamodel); } else { _applicationCommand.Insert(app); } _applicationCommand.SaveChanges(); if (app.Id >= 1) { _activityRepo.CreateActivityLog("creating Framework application data", this.ControllerContext.ActionDescriptor.ControllerName, this.ControllerContext.ActionDescriptor.ActionName, 0, app); return(RedirectToAction("FramewokAdmin")); } ModelState.AddModelError("", "Unable to save framework settings due to internal error! Please try again later"); return(View(_setupContract)); } var application = _applicationQuery.GetAll().FirstOrDefault(); var portalInfo = _mapper.Map <PortalSettingViewModel>(application); if (portalInfo == null) { // ModelState.AddModelError("", "Unable to initialize portal information due to internal error! Please try again later"); return(View(_setupContract)); } _setupContract.PortalSetting = portalInfo; return(View(_setupContract)); //add settings to DB }