public string RemoveProduct_Type(int id) { try { var item = Product_Types.FirstOrDefault(x => x.Product_TypeID == id); Product_Types.Remove(item); SaveChanges(); return("Запись успешно удалена"); } catch (Exception ex) { return(ex.Message); } }
public HttpResponseMessage EditProductType([FromBody] ProductTypesDomain productTypesDomain) { Product_Types product_Types = new Product_Types(); var mapper = InventorySalesMapping.MapConfig.CreateMapper(); mapper.Map(productTypesDomain, product_Types); InventorySalesUOW.ProductTypeRepository.Update(product_Types); InventorySalesUOW.Commit(); return(Request.CreateResponse(HttpStatusCode.OK, "Success")); }
public string AddProduct_Type(string title) { try { Product_Type product_Type = new Product_Type { Title = title }; Product_Types.Add(product_Type); SaveChanges(); return("Запись успешно добавлена"); } catch (Exception ex) { return(ex.Message); } }
public string EditProduct_Type(int id, string title) { try { var item = Product_Types.FirstOrDefault(x => x.Product_TypeID == id); if (item != null) { item.Title = title; } SaveChanges(); return("Запись успешно отредактирована"); } catch (Exception ex) { return(ex.Message); } }
public IHttpActionResult DeleteProductType(int ID) { string Token = HttpContext.Current.Request.Form["Token"]; //Find Type Product_Types type = db.Product_Types.SingleOrDefault(x => x.Product.Provider.Token == Token && x.ID == ID); if (type == null) { return(Ok(new { key = false, Message = "هذا النوع غير موجودة" })); } //Delete Type From DB db.Product_Types.Remove(type); db.SaveChanges(); return(Ok(new { key = true, Message = "تم مسح النوع بنجاح" })); }
public IHttpActionResult AddProductType(int Product_ID) { string Token = HttpContext.Current.Request.Form["Token"]; int Type_ID = int.Parse(HttpContext.Current.Request.Form["Type_ID"]); //Find Product Product product = db.Products.SingleOrDefault(x => x.ID == Product_ID && x.Provider.Token == Token); if (product == null) { return(Ok(new { key = false, Message = "هذا المنتج غير موجود" })); } //Add Type To DB Product_Types type = new Product_Types { Type_ID = Type_ID, Product_ID = product.ID }; db.Product_Types.Add(type); db.SaveChanges(); return(Ok(new { key = true, Message = "تم اضافة النوع بنجاح" })); }
public Product_Types CreateProductTypes() { var productTypes = new Product_Types(); return(productTypes); }
public List <Product_Type> GetAllProduct_Type() => Product_Types.ToList();