public ActionResult Edit(EventTypeEditModel model) { if (!ModelState.IsValid) { return(View(model)); } var dispatcher = GetDispatcherClient(); var data = new UpdateEventTypeRequestData() { EventTypeId = model.Id, DisplayName = model.DisplayName, SystemName = model.SystemName, OldVersion = model.OldVersion, JoinIntervalSeconds = TimeSpanHelper.GetSeconds(model.JoinInterval), ImportanceForOld = model.ImportanceForOld, ImportanceForNew = model.ImportanceForNew, UpdateActualEvents = true }; var response = dispatcher.UpdateEventType(CurrentUser.AccountId, data); response.Check(); this.SetTempMessage(TempMessageType.Success, "Тип события сохранён"); return(RedirectToAction("Show", new { id = model.Id })); }
public ActionResult Edit(Guid id) { var repository = CurrentAccountDbContext.GetEventTypeRepository(); var eventType = repository.GetById(id); CheckEditingPermissions(eventType); var model = new EventTypeEditModel() { Id = eventType.Id, DisplayName = eventType.DisplayName, SystemName = eventType.SystemName, Category = eventType.Category, JoinInterval = eventType.JoinInterval, OldVersion = eventType.OldVersion, ImportanceForOld = eventType.ImportanceForOld, ImportanceForNew = eventType.ImportanceForNew, IsDeleted = eventType.IsDeleted }; return(View(model)); }
public ActionResult Add(EventTypeEditModel model) { if (!ModelState.IsValid) { return(View(model)); } var repository = CurrentAccountDbContext.GetEventTypeRepository(); var eventType = new EventType() { DisplayName = model.DisplayName, SystemName = model.SystemName, Category = EventCategory.ComponentEvent, JoinIntervalSeconds = TimeSpanHelper.GetSeconds(model.JoinInterval), OldVersion = model.OldVersion, ImportanceForOld = model.ImportanceForOld, ImportanceForNew = model.ImportanceForNew }; repository.Add(eventType); this.SetTempMessage(TempMessageType.Success, string.Format("Добавлен тип события <a href='{1}' class='alert-link'>{0}</a>", eventType.DisplayName, Url.Action("Show", new { id = eventType.Id }))); return(RedirectToAction("Index")); }
public ActionResult Add() { var model = new EventTypeEditModel(); return(View(model)); }