/// <summary> /// Xóa tài khoản /// </summary> /// <param name="input"> thông tin tài khoản xóa </param> /// <param name="userId"> Id User đang thao tác </param> /// <returns></returns> public async Task <AtNotify> AccountObject_Delete(AccountObjectDm_Delete input, string userId) { try { var model = await _context.AccountObject.FirstOrDefaultAsync(c => c.Id == input.Id); if (model == null) { return(AtNotify.NotFound); } else if (!model.AtRowVersion.SequenceEqual(input.AtRowVersion)) { return(AtNotify.PhienGiaoDichHetHan); } model.AtRowStatus = (int)AtRowStatus.Hide; model.AtLastModifiedBy = userId; model.AtLastModifiedDate = GetDateTimeFromServer(); await _context.SaveChangesAsync(); string data_Old = JsonConvert.SerializeObject(model); await WrtiteAudittingLog(new MSC_AudittingLog { Description = "Xóa AccountObject với ID:" + input.Id, UserID = userId, Data_Old = data_Old }, AtSerialNoConts.CODE_LOG_DELETE); return(AtNotify.DeleteComplete); } catch (Exception ex) { return(AtNotify.DeleteFail); } }
public async Task <ActionResult <AtResult <AccountObjectDm_Delete> > > AccountObject_Delete([FromBody] AccountObjectDm_Delete input) { if (await CheckPermission(_context)) { if (input == null) { return(new AtResult <AccountObjectDm_Delete>(AtNotify.NotFound)); } try { var output = await _logicAccountObj.AccountObject_Delete(input, UserId); if (output == AtNotify.PhienGiaoDichHetHan || (output == AtNotify.DeleteFail)) { return(new AtResult <AccountObjectDm_Delete>(output)); } else { return(new AtResult <AccountObjectDm_Delete>(input)); } } catch (Exception ex) { throw ex; } } else { return(new AtResult <AccountObjectDm_Delete>(AtNotify.KhongCoQuyenTruyCap)); } }