public static void EditAuthor(AuthorEntity detail) { using (LMSEntities dbe = new DAL.LMSEntities()) { Author author = dbe.Authors.Find(detail.Id); author.FirstName = detail.FirstName; author.LastName = detail.LastName; author.Phone = detail.Phone; author.Email = detail.Email; author.Qualification = detail.Qualification; // dbe.Entry(author).State = System.Data.Entity.EntityState.Modified; dbe.SaveChanges(); } }
public static void SaveAuthor(AuthorEntity detail) { using (LMSEntities dbe = new DAL.LMSEntities()) { Author author = new DAL.Author(); author.Id = detail.Id; author.FirstName = detail.FirstName; author.LastName = detail.LastName; author.Phone = detail.Phone; author.Email = detail.Email; author.Qualification = detail.Qualification; dbe.Authors.Add(author); dbe.SaveChanges(); } }