Beispiel #1
0
 public object Update(CloudDbSQL entity)
 {
     try
     {
         _uow.CloudDbSQL.Update(entity);
         _uow.Complete();
         return(new { message = "Succesfully updated" });
     }
     catch (Exception ex)
     {
         throw new Exception("Failed to update", ex);
     }
     finally
     {
         _uow.Dispose();
     }
 }
Beispiel #2
0
        public CloudDbSQL Get(int id)
        {
            try
            {
                CloudDbSQL result = _uow.CloudDbSQL.Get(id);
                if (result == null)
                {
                    throw new Exception("Not found");
                }

                return(result);
            }
            catch (Exception ex)
            {
                throw new Exception("Failed to get by id", ex);
            }
        }
Beispiel #3
0
 public object Add(CloudDbSQL entity)
 {
     try
     {
         _uow.CloudDbSQL.Add(entity);
         _uow.Complete();
         return(new { message = "Succesfully added" });
     }
     catch (Exception ex)
     {
         throw new Exception("Failed at adding new object", ex);
     }
     finally
     {
         _uow.Dispose();
     }
 }
 public ActionResult Remove([FromBody] CloudDbSQL cloudDbSQL)
 {
     return(Ok(_dbSQLService.Remove(cloudDbSQL)));
 }
 public ActionResult Update([FromBody] CloudDbSQL cloudDbSQL)
 {
     return(Ok(_dbSQLService.Update(cloudDbSQL)));
 }
 public ActionResult Add([FromBody] CloudDbSQL cloudDbSQL)
 {
     return(Ok(_dbSQLService.Add(cloudDbSQL)));
 }
Beispiel #7
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);
        }