public async Task <AtNotify> UpdateHoSoCaNhan(AccountObjectDm_UpdateAccount input, string userId) { try { var model = await _context.AccountObject.FirstOrDefaultAsync(c => c.Id == userId); if (model == null) { return(AtNotify.NotFound); } var data_old = JsonConvert.SerializeObject(new AccountObjectDm_UpdateAccount { AccountObjectName = model.AccountObjectName, Phone = model.Phone, Email = model.Email }); if (!string.IsNullOrWhiteSpace(input.AccountObjectName)) { model.AccountObjectName = input.AccountObjectName; } if (!string.IsNullOrWhiteSpace(input.Email)) { model.Email = input.Email; } if (!string.IsNullOrWhiteSpace(input.Phone)) { model.Phone = input.Phone; } model.AtLastModifiedBy = userId; model.AtLastModifiedDate = GetDateTimeFromServer(); await _context.SaveChangesAsync(); var data_new = JsonConvert.SerializeObject(new AccountObjectDm_ResetPassword { Id = model.Id, AtRowVersion = model.AtRowVersion, PassWord = model.PassWord }); await WrtiteAudittingLog(new MSC_AudittingLog { Description = "Sửa hồ sơ cá nhân với ID: " + model.Id, UserID = userId, Data_New = data_new, Data_Old = data_old }, AtSerialNoConts.CODE_LOG_CREATE); return(AtNotify.UpdateCompelete); } catch (Exception ex) { throw ex; } }
public async Task <ActionResult <AtResult <AccountObjectDm_UpdateAccount> > > AccountObject_Update([FromBody] AccountObjectDm_UpdateAccount input) { if (await CheckPermission(_context)) { try { var ouput = await _logicAccountObj.UpdateHoSoCaNhan(input, UserId); if (ouput == AtNotify.PhienGiaoDichHetHan || ouput == AtNotify.NotFound) { return(new AtResult <AccountObjectDm_UpdateAccount>(ouput)); } return(new AtResult <AccountObjectDm_UpdateAccount>(input)); } catch (Exception ex) { throw ex; } } else { return(new AtResult <AccountObjectDm_UpdateAccount>(AtNotify.KhongCoQuyenTruyCap)); } }