public async Task <Result> AddClinicAsync(MedClinic clinic) { try { clinic.IsActive = true; _dbContext.Add(clinic); await _dbContext.SaveChangesAsync(); return(new SuccessResult(clinic, _sharedLocalizer["InsertMessage"])); } catch (Exception ex) { return(new FailureResult(ex.Message)); } }
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 <ActionResult <Result> > UpdateClinicAsync(MedClinic clinic) { var result = await _clinicService.UpdateClinicAsync(clinic); return(result); }