public async Task <IActionResult> Edit(int id, [Bind("ModifiedUserId,ModifiedDateTime,ScheduleId,MarketId,ScheduleTypeId,ScheduleName,ScheduleStartDate,ScheduleEndDate,FileName,FilePath,IsPreAdjudicated,IsScrubEnabled,ScheduleStatusId,Count,SourceTypeId,IsResubmit,IsForceVoid,IsAutoGenerateFile,ScheduleError")] PharmSchedule pharmSchedule) { if (id != pharmSchedule.ScheduleId) { return(NotFound()); } if (ModelState.IsValid) { try { await repository.SaveSchedule(pharmSchedule); } catch (DbUpdateConcurrencyException) { if (!PharmScheduleExists(pharmSchedule.ScheduleId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(pharmSchedule)); }
public async Task <IActionResult> Create([Bind("ModifiedUserId,ModifiedDateTime,ScheduleId,MarketId,ScheduleTypeId,ScheduleName,ScheduleStartDate,ScheduleEndDate,FileName,FilePath,IsPreAdjudicated,IsScrubEnabled,ScheduleStatusId,Count,SourceTypeId,IsResubmit,IsForceVoid,IsAutoGenerateFile,ScheduleError")] PharmSchedule pharmSchedule) { if (ModelState.IsValid) { await repository.SaveSchedule(pharmSchedule); return(RedirectToAction(nameof(Index))); } return(View(pharmSchedule)); }
public async Task SaveSchedule(PharmSchedule schedule) { PharmSchedule sch = await context.PharmSchedule.FirstOrDefaultAsync(x => x.ScheduleId == schedule.ScheduleId); if (sch == null) { context.PharmSchedule.Add(schedule); } else { sch.ScheduleStatusId = schedule.ScheduleStatusId; } await context.SaveChangesAsync(); }