//INSERT- UPDATE - DELETE public int Insert(string UserId, string ComposerName, string FrontImage, string MainImage, string Description, string Status) { using (MediaEntities dbContext = new MediaEntities()) { string Alias = StringUtils.GenerateFriendlyString(ComposerName); dbContext.CommandTimeout = Settings.CommandTimeout; System.Nullable <Int32> ListOrder = (from u in dbContext.Media_Composers select u.ListOrder).DefaultIfEmpty(0).Max() + 1; Media_Composers composers_obj = new Media_Composers(); composers_obj.ComposerName = ComposerName; composers_obj.Alias = Alias; composers_obj.FrontImage = FrontImage; composers_obj.MainImage = MainImage; composers_obj.Description = Description; composers_obj.ListOrder = (ListOrder == null ? 1 : ListOrder); composers_obj.IPLog = IP; composers_obj.CreatedOnDate = System.DateTime.Now; composers_obj.CreatedByUserId = new Guid(UserId); composers_obj.Status = Status; dbContext.AddToMedia_Composers(composers_obj); int i = dbContext.SaveChanges(); return(i); } }