public async Task <IActionResult> Create(MoDot moDot) { var allXDDG = await _serviceXDDG.GetAll(); if (allXDDG.Any()) { foreach (var item in allXDDG) { item.Status = 0; await _serviceXDDG.Update(item); } } var HoiDong = await _serviceHoiDong.GetAll(); if (HoiDong.Any()) { foreach (var item in HoiDong) { item.StatusPhanCong = (int)StatusPhanCong.ChuaPhanCong; await _serviceHoiDong.Update(item); } } var DeTai = await _serviceDeTai.GetAll(); if (DeTai.Any()) { foreach (var item in DeTai) { item.TinhTrangPhanCong = (int)StatusPhanCong.ChuaPhanCong; await _serviceDeTai.Update(item); } } if (moDot.Loai == (int)MoDotLoai.DangKy) { var Nhom = await _serviceNhom.GetAll(); if (Nhom.Any()) { foreach (var item in Nhom) { item.Status = (int)BaseStatus.Disable; await _serviceNhom.Update(item); } } } moDot.Status = 1; moDot.IdquanLy = long.Parse(User.Identity.Name); await _service.Add(moDot); return(RedirectToAction("Index", new { mess = "Mở đợt thành công" })); }
public async Task <IActionResult> BaoCao(BaoCaoXDDGViewModel model) { var XDDG = await _serviceXDDG.GetById(model.IdXDDG); XDDG.NoiDung = model.NoiDung; if (await UpLoadFileXDDG(model.File, XDDG)) { await _serviceXDDG.Update(XDDG); return(Ok(new { status = true, mess = MessageResult.UpdateSuccess })); } else { return(Ok(new { status = false, mess = MessageResult.UpLoadFileFail })); } }