public string Addcustom(int pid, int filter, string size) { var ty = (from p in db.Custom_Products where p.Filter.Equals(filter) select p).FirstOrDefault(); if (ty == null) { var newtype = new Custom_Product { Filter = filter, Custom_Size = size }; db.Custom_Products.InsertOnSubmit(newtype); try { db.SubmitChanges(); return("added"); } catch (Exception ex) { ex.GetBaseException(); return("not added"); } } else { return("error"); } }
public string Addcustom(int filter, string size, string colour, string imageURL = "") { if (imageURL != null) { var newtype = new Custom_Product { Filter = filter, Custom_Size = size, Colour = colour, Logo = imageURL }; db.Custom_Products.InsertOnSubmit(newtype); try { db.SubmitChanges(); return("added"); } catch (Exception ex) { ex.GetBaseException(); return("not added"); } } else { var newtype = new Custom_Product { Filter = filter, Custom_Size = size, Colour = colour }; db.Custom_Products.InsertOnSubmit(newtype); try { db.SubmitChanges(); return("added"); } catch (Exception ex) { ex.GetBaseException(); return("not added"); } } }