//פונקציה לעדכון קטגוריה public static List <categoryEntity> EditCategory(categoryEntity c) { try { categoryTBL categoryForUpdate = connectDB.entity.categoryTBL.FirstOrDefault(x => x.id == c.id); categoryForUpdate.name = c.name; connectDB.entity.SaveChanges(); } catch { } return(categoryEntity.ConvertListDBToListEntity(connectDB.entity.categoryTBL.ToList())); }
//פונקציה להוספת קטגוריה public static List <categoryEntity> AddToList(categoryEntity c) { //DB? הוא לא מצליח לעדכן ב try and catch למה כשיש try { connectDB.entity.categoryTBL.Add(categoryEntity.ConvertEntityToDB(c)); connectDB.entity.SaveChanges(); } catch { } return(categoryEntity.ConvertListDBToListEntity(connectDB.entity.categoryTBL.ToList())); }
public List <categoryEntity> EditCategory([FromBody] categoryEntity c) { return(CategoriesBL.EditCategory(c)); }
public List <categoryEntity> AddToList([FromBody] categoryEntity c) { return(CategoriesBL.AddToList(c)); }