public async Task <ActionResult> Save(Role obj) { try { Role entities = new Role(); if (obj.RoleID != 0) { entities = commonBu.Get <Role>(obj.RoleID); if (entities != null) { entities.GetTransferData(obj); commonBu.Update(entities); ViewBag.Status = "1"; } else { ViewBag.Status = "-1"; } } else { commonBu.Save(obj); ViewBag.Status = "1"; } } catch (Exception ex) { ViewBag.Status = "-1"; } return(PartialView(Constants.VIEW.SAVE_RESULT)); }
public ActionResult Save(Menu obj) { try { Menu entities = new Menu(); if (obj.MenuID != 0) { entities = commonBu.Get <Menu>(obj.MenuID); if (entities != null) { entities.GetTransferData(obj); commonBu.Update(entities); } } else { entities.GetTransferData(obj); commonBu.Save(entities); } ViewBag.Status = "1"; } catch (Exception ex) { if (ex.Message.Contains("401")) { ViewBag.Status = "-2"; } } return(PartialView(Constants.VIEW.SAVE_RESULT)); }
public OutPutDTO Save([FromBody] Role obj) { if (!ModelState.IsValid) { new OutPutDTO(false, Constants.STATUS_CODE.FAILURE, Constants.STATUS_MESSAGE.FAILURE, null); } try { Role entities = new Role(); if (obj.RoleID != 0) { entities = commonBu.Get <Role>(obj.RoleID); if (entities != null) { entities.GetTransferData(obj); commonBu.Update(entities); return(new OutPutDTO(true, Constants.STATUS_CODE.SUCCESS, Constants.STATUS_MESSAGE.SUCCESS, entities)); } else { return(new OutPutDTO(false, Constants.STATUS_CODE.FAILURE, Constants.STATUS_MESSAGE.FAILURE, null)); } } else { commonBu.Save(obj); return(new OutPutDTO(true, Constants.STATUS_CODE.SUCCESS, Constants.STATUS_MESSAGE.SUCCESS, obj)); } } catch (Exception ex) { return(new OutPutDTO(false, Constants.STATUS_CODE.EXCEPTION, Constants.STATUS_MESSAGE.EXCEPTION + ex.Message, null)); } }
public OutPutDTO GetObjectApplications(int id) { try { Application obj = commonBu.Get <Application>(id); return(new OutPutDTO(true, Constants.STATUS_CODE.SUCCESS, Constants.STATUS_MESSAGE.SUCCESS, obj)); } catch (Exception ex) { return(new OutPutDTO(false, Constants.STATUS_CODE.EXCEPTION, Constants.STATUS_MESSAGE.EXCEPTION + ex.Message, null)); } }