Пример #1
0
        private double SumTotalPrice(CloudVM key1, CloudStorage key2, CloudFunction key3, CloudDbSQL key4)
        {
            double sum = 0;

            sum += key1 != null ? key1.Price : 0;
            sum += key2 != null ? key2.Price : 0;
            sum += key3 != null ? key3.Price : 0;
            sum += key4 != null ? key4.Price : 0;
            return(sum);
        }
Пример #2
0
 public object Update(CloudVM entity)
 {
     try
     {
         _uow.CloudVM.Update(entity);
         _uow.Complete();
         return(new { message = "Succesfully updated" });
     }
     catch (Exception ex)
     {
         throw new Exception("Failed to update", ex);
     }
     finally
     {
         _uow.Dispose();
     }
 }
Пример #3
0
        public CloudVM Get(int id)
        {
            try
            {
                CloudVM result = _uow.CloudVM.Get(id);
                if (result == null)
                {
                    throw new Exception("Not found");
                }

                return(result);
            }
            catch (Exception ex)
            {
                throw new Exception("Failed to get by id", ex);
            }
        }
Пример #4
0
 public object Add(CloudVM entity)
 {
     try
     {
         _uow.CloudVM.Add(entity);
         _uow.Complete();
         return(new { message = "Succesfully added" });
     }
     catch (Exception ex)
     {
         throw new Exception("Failed at adding new object", ex);
     }
     finally
     {
         _uow.Dispose();
     }
 }
Пример #5
0
 public ActionResult Remove([FromBody] CloudVM cloudVM)
 {
     return(Ok(_cloudVMService.Remove(cloudVM)));
 }
Пример #6
0
 public ActionResult Update([FromBody] CloudVM cloudVM)
 {
     return(Ok(_cloudVMService.Update(cloudVM)));
 }
Пример #7
0
 public ActionResult Add([FromBody] CloudVM cloudVM)
 {
     return(Ok(_cloudVMService.Add(cloudVM)));
 }