Exemplo n.º 1
0
 public IHttpActionResult DeleteRole(int id)
 {
     using (var db = new OMSEF())
     {
         var userRole = db.UserRoles.Where(s => s.RoleId == id).FirstOrDefault();
         if (userRole != null)
         {
             db.Entry(userRole).State = System.Data.Entity.EntityState.Deleted;
             db.SaveChanges();
         }
         return(Ok());
     }
 }
 public IHttpActionResult DeleteAddress(int id)
 {
     using (var db = new OMSEF())
     {
         var shippingAddress = db.ShippingAddresses.Where(s => s.AddressID == id).FirstOrDefault();
         if (shippingAddress != null)
         {
             db.Entry(shippingAddress).State = System.Data.Entity.EntityState.Deleted;
             db.SaveChanges();
         }
         return(Ok());
     }
 }
Exemplo n.º 3
0
        public IHttpActionResult DeleteCustomer(int id)
        {
            if (id != null)
            {
                using (var db = new OMSEF())
                {
                    var customerDetail = db.CustomerDetails.Where(s => s.CustomerId == id).FirstOrDefault();
                    if (customerDetail != null)
                    {
                        db.Entry(customerDetail).State = System.Data.Entity.EntityState.Deleted;
                        db.SaveChanges();
                    }

                    return(Ok());
                }
            }
            else
            {
                return(BadRequest());
            }
        }