コード例 #1
0
 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.
     }
 }
コード例 #2
0
        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));
            }
        }
コード例 #3
0
        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());
            }
        }