Beispiel #1
0
 public async Task <IActionResult> Update(StirDTO update)
 {
     if (await _settingService.Update(update))
     {
         return(NoContent());
     }
     return(BadRequest($"Updating stir {update.ID} failed on save"));
 }
Beispiel #2
0
        public async Task <IActionResult> Create(StirDTO create)
        {
            //create.CreatedDate = DateTime.Now;
            if (await _settingService.Add(create))
            {
                return(NoContent());
            }

            throw new Exception("Creating the Stir failed on save");
        }
Beispiel #3
0
 public async Task <bool> Add(StirDTO model)
 {
     try
     {
         var stir = _mapper.Map <Stir>(model);
         _repoStir.Add(stir);
         return(await _repoStir.SaveAll());
     }
     catch (System.Exception)
     {
         throw;
     }
 }
Beispiel #4
0
        public async Task <bool> Update(StirDTO model)
        {
            try
            {
                var item = await _repoStir.FindAll().FirstOrDefaultAsync(x => x.ID == model.ID);

                if (item == null)
                {
                    return(false);
                }
                item.RPM          = model.RPM;
                item.Status       = model.Status;
                item.TotalMinutes = model.TotalMinutes;
                _repoStir.Update(item);
                return(await _repoStir.SaveAll());
            }
            catch (System.Exception)
            {
                throw;
            }
        }