public IServiceResultWrap SaveWebPageChannel([FromBody] VmWebPageChannel model) { return serviceManager.CallService( () => new ServiceResultWrap { Data = GetWebPageChannelData(model) } , new Dictionary<Type, string>() { { typeof(string), EntityMessageSaved }, { typeof(PtvArgumentException), MessageArgumentException }, { typeof(RoleActionException), model.Id.HasValue ? MessageSaveChannelRole : MessageAddChannelRole } } ); }
private IVmBase GetWebPageChannelData(VmWebPageChannel model) { VmWebPageChannel result = null; switch (model.Action) { case ActionTypeEnum.Save: result = channelService.SaveWebPageChannel(model); break; case ActionTypeEnum.SaveAndValidate: result = channelService.SaveAndValidateWebPageChannel(model); break; default: result = channelService.SaveWebPageChannel(model); break; } channelService.UnLockChannel(result.Id.Value); return result; }