public ActionResult Create() { var timeZone = this.TimeZoneService.Create(); var privilege = new TimeZonePrivilege(); return privilege.CanCreate(timeZone) ? base.View(Views.Create, new TimeZoneCreateOrUpdate()) : NotAuthorized(); }
public ActionResult Create(TimeZoneCreateOrUpdate value) { if (value == null) { throw new ArgumentNullException("value"); } var timeZone = this.TimeZoneService.Create(); var privilege = new TimeZonePrivilege(); if (!privilege.CanCreate(timeZone)) { return NotAuthorized(); } value.Validate(); if (value.IsValid) { value.ValueToModel(timeZone); this.TimeZoneService.InsertOrUpdate(timeZone); value = new TimeZoneCreateOrUpdate(timeZone); value.SuccessMessage(Messages.TimeZoneCreated.FormatInvariant(timeZone.Title)); } else { value.CopyToModel(ModelState); } return base.View(Views.Update, value); }