public void Delete(EmailMergeModel emailMergeModelToDelete) { _serviceContext.Detach(emailMergeModelToDelete); _serviceContext.AttachTo(EmailMergeDataServiceContext.EmailMergeTableName, emailMergeModelToDelete, "*"); _serviceContext.DeleteObject(emailMergeModelToDelete); _serviceContext.SaveChanges(); }
public ActionResult Create(EmailMergeModel emailMergeModel) { if (!ModelState.IsValid) return View(); emailMergeModel.LastEditStamp = DateTime.Now; emailMergeModel.RowKey = Guid.NewGuid().ToString(); var emailMergeRepository = new EmailMergeRepository(); emailMergeRepository.Insert(emailMergeModel); return RedirectToAction("List"); }
private static EmailMergeModel StampIt(EmailMergeModel emailMergeModel) { // This is a sample of adding a cross cutting concern or similar functionality. emailMergeModel.LastEditStamp = DateTime.Now; return emailMergeModel; }
public void Update(EmailMergeModel emailMergeModelUpdate) { var emailMergeModelOld = GetEmailMergeModel(emailMergeModelUpdate.RowKey); Delete(emailMergeModelOld); Insert(StampIt(emailMergeModelUpdate)); }
public void Insert(EmailMergeModel emailMergeModel) { _serviceContext.AddObject(EmailMergeDataServiceContext.EmailMergeTableName, StampIt(emailMergeModel)); _serviceContext.SaveChanges(); }
public ActionResult Edit(EmailMergeModel emailMergeModel) { var tableStorageDataSource = new EmailMergeRepository(); tableStorageDataSource.Update(emailMergeModel); return RedirectToAction("List"); }