public IHttpActionResult Update(int id, object dtoItem) { Library.DTO.Notification notification; Module.Framework.BLL fwBll = new Module.Framework.BLL(); if (id > 0 && !fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanUpdate)) { return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED))); } else if (id == 0 && !fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanCreate)) { return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED))); } // continue processing executor.UpdateData(ControllerContext.GetAuthUserId(), id, ref dtoItem, out notification); if (notification.Type == Library.DTO.NotificationType.Error) { return(InternalServerError(new Exception(notification.Message))); } return(Ok(new Library.DTO.ReturnData <object>() { Data = dtoItem, Message = notification })); }
public IHttpActionResult Update(int id, object dtoItem) { Library.DTO.Notification notification; // authentication Module.Framework.BLL fwBll = new Module.Framework.BLL(); if (id > 0 && !fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanUpdate)) { // edit case return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED))); } else if (id == 0 && !fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanCreate)) { // create new case return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED))); } //// validation //if (!Helper.CommonHelper.ValidateDTO<DTO.MaterialColorMng.MaterialColor>(ref dtoItem, out notification)) //{ // return Ok(new Library.DTO.ReturnData<DTO.MaterialColorMng.MaterialColor>() { Data = dtoItem, Message = notification }); //} executor.UpdateData(ControllerContext.GetAuthUserId(), id, ref dtoItem, out notification); return(Ok(new Library.DTO.ReturnData <object>() { Data = dtoItem, Message = notification })); }
public IHttpActionResult Update(int id, object dtoItem) { // authentication if (id > 0 && !fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, ModuleAction.CanUpdate)) { // edit case return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED))); } if (id == 0 && !fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, ModuleAction.CanCreate)) { // create new case return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED))); } Notification notification; //set indenfier is tempFolder which to use to save image executor.identifier = ControllerContext.GetCurrentUserFolder(); //update data executor.UpdateData(ControllerContext.GetAuthUserId(), id, ref dtoItem, out notification); return(Ok(new ReturnData <object>() { Data = dtoItem, Message = notification })); }
public IHttpActionResult Update(int id, object dtoItem) { // authentication if (id > 0 && !fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanUpdate)) { // edit case return(Ok(new Library.DTO.ReturnData <Object>() { Data = null, Message = new Library.DTO.Notification { Type = Library.DTO.NotificationType.Error, Message = "Not authorized!" }, TotalRows = 0 })); } else if (id == 0 && !fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanCreate)) { // create new case return(Ok(new Library.DTO.ReturnData <Object>() { Data = null, Message = new Library.DTO.Notification { Type = Library.DTO.NotificationType.Error, Message = "Not authorized!" }, TotalRows = 0 })); } executor.UpdateData(ControllerContext.GetAuthUserId(), id, ref dtoItem, out Library.DTO.Notification notification); return(Ok(new Library.DTO.ReturnData <object>() { Data = dtoItem, Message = notification })); }
public IHttpActionResult Update(int id, object dtoItem) { // authentication if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanUpdate)) { return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED))); } executor.UpdateData(ControllerContext.GetAuthUserId(), id, ref dtoItem, out Notification notification); return(Ok(new ReturnData <object>() { Data = dtoItem, Message = notification })); }
public IHttpActionResult Update(int id, object dtoItem) { if (HasNotUpdatePermission(id, out IHttpActionResult httpActionResult)) { return(httpActionResult); } SetModuleIdenfitier(executor); executor.UpdateData(ControllerContext.GetAuthUserId(), id, ref dtoItem, out Notification notification); return(Ok(new ReturnData <object>() { Data = dtoItem, Message = notification })); }
public IHttpActionResult UpdateData(int id, object dtoItem) { Library.DTO.Notification notification = null; // Check authentication if ((id > 0 && !frameworkBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanUpdate)) || (id == 0 && !frameworkBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanCreate))) { return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED))); } iExecutor.UpdateData(ControllerContext.GetAuthUserId(), id, ref dtoItem, out notification); return(Ok(new Library.DTO.ReturnData <object>() { Data = dtoItem, Message = notification })); }
public IHttpActionResult Update(int id, object dtoItem) { // authentication BLL.Framework fwBll = new BLL.Framework(); if (id > 0 && !fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanUpdate)) { // edit case return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED))); } else if (id == 0 && !fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanCreate)) { // create new case return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED))); } //executor.identifier = Helper.AuthHelper.GetCurrentUserFolder(ControllerContext); executor.UpdateData(ControllerContext.GetAuthUserId(), id, ref dtoItem, out Library.DTO.Notification notification); return(Ok(new Library.DTO.ReturnData <object>() { Data = dtoItem, Message = notification })); }