public async Task <bool> Update(CustomLogViewModel model) { model.EditedTime = DateTime.Now; var isSuccess = await _dataAccess.CustomLogRepository.Update(model); return(isSuccess); }
public async Task <bool> Add(CustomLogViewModel model) { model.CreatedTime = DateTime.Now; var isSuccess = await _dataAccess.CustomLogRepository.Add(model); _toastNotification.AddSuccessToastMessage("We got your message. thanks for your feedback"); return(isSuccess); }
public async Task <bool> Delete(CustomLogViewModel model) { //check for recird is exist var customLog = await IsExist(model.Id.Value); customLog.IsDeleted = true; await _context.SaveChangesAsync(); return(true); }
public async Task <bool> Add(CustomLogViewModel model) { try { var log = MapViewModelToModel(model); await _context.CustomLogs.AddAsync(log); await _context.SaveChangesAsync(); return(true); } catch (Exception ex) { Console.WriteLine(ex.Message); throw; } }
public async Task <bool> Add(CustomLogViewModel model) { try { var res = await GetItemByCondition <Competition>(p => p.Id == 4); var log = MapViewModelToModel(model); await _context.CustomLogs.AddAsync(log); await _context.SaveChangesAsync(); return(true); } catch (Exception ex) { Console.WriteLine(ex.Message); throw; } }
public async Task <bool> Update(CustomLogViewModel model) { //check for recird is exist var log = await IsExist(model.Id.Value); log.Id = model.Id.Value; log.CreatedTime = model.CreatedTime; log.EditedTime = model.EditedTime; log.Title = model.Title; log.Description = model.Description; log.LogType = model.LogType; log.Message1 = model.Message1; log.Message2 = model.Message2; // log = MapViewModelToModel(model); //var result = await Update(log); //_context.Update(model); await _context.SaveChangesAsync(); return(true); }
//map customlog view model to customlog entity public CustomLog MapViewModelToModel(CustomLogViewModel model) { try { var log = new CustomLog() { CreatedTime = model.CreatedTime, EditedTime = model.EditedTime, Title = model.Title, Description = model.Description, LogType = model.LogType, Message1 = model.Message1, Message2 = model.Message2, }; return(log); } catch (Exception ex) { throw new Exception("not could log mapping"); throw; } }
public async Task <IActionResult> Edit(CustomLogViewModel model) { await _uow.CustomLogService.Update(model); return(RedirectToAction("Index")); }