public bool InsertAbout(mAbout pAbout) { try { tbl_about vAbout = new tbl_about(); var query = from b in Db.tbl_about orderby b.about_us_id descending select b; vAbout = query.FirstOrDefault(); tbl_about l = new tbl_about(); l.about_exp_en_one = pAbout.about_exp_en_one; l.about_exp_en_two = pAbout.about_exp_en_two; l.about_summery = pAbout.about_summery; l.about_us_exp_one = pAbout.about_us_exp_one; l.about_us_exp_two = pAbout.about_us_exp_two; l.about_us_img = pAbout.about_us_img; l.about_us_img_alt = pAbout.about_us_img_alt; l.about_us_img_height = pAbout.about_us_img_height; l.about_us_img_width = pAbout.about_us_img_width; l.about_us_title = pAbout.about_us_title; l.about_us_type = pAbout.about_us_type; l.about_us_id = vAbout.about_us_id + 1; Db.tbl_about.Add(l); return(Convert.ToBoolean(Db.SaveChanges())); } catch (Exception) { return(false); } }
public bool fUpdateAbout(mAbout pAbout) { try { tbl_about l = new tbl_about(); l.about_us_id = pAbout.about_us_id; l.about_exp_en_one = pAbout.about_exp_en_one; l.about_exp_en_two = pAbout.about_exp_en_two; l.about_summery = pAbout.about_summery; l.about_us_exp_one = pAbout.about_us_exp_one; l.about_us_exp_two = pAbout.about_us_exp_two; l.about_us_img = pAbout.about_us_img; l.about_us_img_alt = pAbout.about_us_img_alt; l.about_us_img_height = pAbout.about_us_img_height; l.about_us_img_width = pAbout.about_us_img_width; l.about_us_title = pAbout.about_us_title; l.about_us_type = pAbout.about_us_type; Db.tbl_about.Attach(l); Db.Entry(l).State = System.Data.Entity.EntityState.Modified; return(Convert.ToBoolean(Db.SaveChanges())); } catch (Exception) { return(false); } }