public async Task CreateActionControllerLog(ActionControllerLog actionController) { try { actionController.IsActive = true; _dbContext.Add(actionController); await _dbContext.SaveChangesAsync(); } catch (Exception ex) { // while logging if there is a trouble, don't interrupt the process of app. } }
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> AddEquipmentAsync(MedEquipmentDto equipment) { try { MedEquipment entity = equipment.Adapt <MedEquipment>(); entity.IsActive = true; _dbContext.Add(entity); await _dbContext.SaveChangesAsync(); entity.Clinic = await _dbContext.MedClinic.FindAsync(entity.ClinicId); equipment = entity.Adapt <MedEquipmentDto>(); return(new SuccessResult(equipment, "Record has been added.")); } catch (Exception ex) { return(new FailureResult()); } }