示例#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)));
 }