public async Task <Result> UpdateClinicAsync(MedClinic clinic) { try { var entity = await _dbContext.FindAsync <MedClinic>(clinic.Id); entity.Name = clinic.Name; _dbContext.Update(entity); await _dbContext.SaveChangesAsync(); return(new SuccessResult(entity, _sharedLocalizer["UpdateMessage"])); } catch (Exception ex) { return(new FailureResult()); } }
public async Task <Result> UpdateEquipmentAsync(MedEquipmentDto equipment) { try { var entity = await _dbContext.FindAsync <MedEquipment>(equipment.Id); entity.ClinicId = equipment.ClinicId; entity.CountInfo = equipment.CountInfo; entity.IsActive = true; entity.Name = equipment.Name; entity.ProvideDate = equipment.ProvideDate; entity.UsageRate = equipment.UsageRate; _dbContext.Update(entity); await _dbContext.SaveChangesAsync(); return(new SuccessResult(entity, "Record has been updated.")); } catch (Exception ex) { return(new FailureResult(ex.Message)); } }