Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- The class is used in MVCnamespace Storage.Models
- {
- public class Topic : TableServiceEntity
- {
- [DisplayName("Partition Key")]
- public override string PartitionKey { get; set; }
- [DisplayName("Row Key")]
- public override string RowKey { get; set; }
- [DisplayName("Description")]
- public string Description { get; set; }
- public DateTime Created { get; set; }
- public DateTime Modified { get; set; }
- public String CreatedBy { get; set; }
- public string ModifiedBy { get; set; }
- }
- }
- public ActionResult Create(MyCreateViewModel viewModel)
- {
- if (ModelState.IsValid)
- {
- viewModel.Entity.Created = DateTime.UtcNow;
- _myService.Insert(viewModel.Entity);
- _myService.SaveChanges();
- return this.RedirectToAction(x => x.Index());
- } else {
- PopulateViewModel(viewModel);
- return View(viewModel);
- }
- }
- public ActionResult Edit(MyEditViewModel viewModel)
- {
- if (ModelState.IsValid)
- {
- viewModel.Entity.LastEditDate= DateTime.UtcNow;
- _myService.AttachAndUpdate(viewModel.Entity);
- _myService.SaveChanges();
- return this.RedirectToAction(x => x.Index());
- } else {
- PopulateViewModel(viewModel);
- return View(viewModel);
- }
- }
- public class Topic
- {
- public Topic()
- {
- this.Created = DateTime.Now;
- this.CreatedBy = UserName;
- }
- [DisplayName("Partition Key")]
- public override string PartitionKey { get; set; }
- [DisplayName("Row Key")]
- public override string RowKey { get; set; }
- [DisplayName("Description")]
- public string Description { get; set; }
- public DateTime Created { get; set; }
- public DateTime Modified { get; set; }
- public String CreatedBy { get; set; }
- public string ModifiedBy { get; set; }
- }
Add Comment
Please, Sign In to add comment