public IHttpActionResult Put(int id, [FromBody] Questionup techskill) { using (DBModel db = new DBModel()) { var entity = db.Questionups.Find(id); if (entity == null) { return(NotFound()); } else { entity.Qn = techskill.Qn; entity.ImageName = techskill.ImageName; entity.Option1 = techskill.Option1; entity.Option2 = techskill.Option2; entity.Option3 = techskill.Option3; entity.Option4 = techskill.Option4; entity.Answer = techskill.Answer; entity.Difficulty = techskill.Difficulty; db.SaveChanges(); return(Ok("Record Updated Successfully......")); } } }
public Questionup Insert(Questionup model) { using (DBModel db = new DBModel()) { db.Questionups.Add(model); db.SaveChanges(); return(model); } }