public async Task <IActionResult> UserGet(long Id) { string to = HttpContext.User.FindFirst("Ma_To").Value; string bp = HttpContext.User.FindFirst("Ma_BP").Value; TblDailyDetail tbl = new TblDailyDetail(); if (Id > 0) { tbl = await _detailDiaryRepository.GetByMa(Id); } ViewBag.JobList = new SelectList(await _jobRepository.GetJobList(to, bp), "Id", "TenJob"); return(PartialView("_UserInput", tbl)); }
public async Task <bool> Update(TblDailyDetail tbl) { try { _db.Entry(tbl).State = EntityState.Modified; await _db.SaveChangesAsync(); Calculator(tbl.DailyId); return(true); } catch { return(false); } }
public async Task <bool> Delete(long ma) { try { TblDailyDetail tbl = new TblDailyDetail(); tbl.Id = ma; _db.Entry(tbl).State = EntityState.Deleted; await _db.SaveChangesAsync(); Calculator(tbl.DailyId); return(true); } catch { return(false); } }
public async Task <IActionResult> Save([FromBody] TblDailyDetail tbl) { bool status = await(tbl.Id > 0 ? _detailDiaryRepository.Update(tbl) : _detailDiaryRepository.Save(tbl)); return(Ok(new { status = status })); }