public async Task <IActionResult> Edit(Email_ConfigView Email_Config)
        {
            ResponseHelper objHelper = new ResponseHelper();

            if (!ModelState.IsValid)
            {
                objHelper.Status  = StatusCodes.Status424FailedDependency;
                objHelper.Message = ModelException.Errors(ModelState);
                return(BadRequest(objHelper));
            }

            try
            {
                if (Email_ConRepo.Exists(Email_Config))
                {
                    objHelper.Status  = StatusCodes.Status200OK;
                    objHelper.Message = "Data already available";
                    return(Ok(objHelper));
                }

                await Email_ConRepo.Update(Email_Config);

                objHelper.Status  = StatusCodes.Status200OK;
                objHelper.Message = "Saved Successfully";
                return(Ok(objHelper));
            }
            catch (Exception ex)
            {
                objHelper.Status  = StatusCodes.Status500InternalServerError;
                objHelper.Message = ex.Message;
                return(StatusCode(StatusCodes.Status500InternalServerError, objHelper));
            }
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Add(Module_PermissionView module_permission)
        {
            ResponseHelper objHelper = new ResponseHelper();

            if (!ModelState.IsValid)
            {
                objHelper.Status  = StatusCodes.Status424FailedDependency;
                objHelper.Message = ModelException.Errors(ModelState);
                return(BadRequest(objHelper));
            }

            try
            {
                if (Module_PermissionRepo.Exists(module_permission))
                {
                    objHelper.Status  = StatusCodes.Status200OK;
                    objHelper.Message = "Data already available";
                    return(Ok(objHelper));
                }
                await Module_PermissionRepo.Insert(module_permission);

                objHelper.Status  = StatusCodes.Status200OK;
                objHelper.Message = "Saved Successfully";
                objHelper.Data    = module_permission;
                return(Ok(objHelper));
            }
            catch (Exception ex)
            {
                objHelper.Status  = StatusCodes.Status500InternalServerError;
                objHelper.Message = ex.Message;
                return(StatusCode(StatusCodes.Status500InternalServerError, objHelper));
            }
        }
Ejemplo n.º 3
0
        //[TypeFilter(typeof(ActionFilters.RolesValidate), Arguments = new object[] { "Department", EnumPermission.Add })]
        public async Task <IActionResult> Add(DepartmentView department)
        {
            ResponseHelper objHelper = new ResponseHelper();

            if (!ModelState.IsValid)
            {
                objHelper.Status  = StatusCodes.Status424FailedDependency;
                objHelper.Message = ModelException.Errors(ModelState);
                return(BadRequest(objHelper));
            }

            try
            {
                if (departmentRepository.Exists(department))
                {
                    objHelper.Status  = StatusCodes.Status200OK;
                    objHelper.Message = "Data already available";
                    return(Ok(objHelper));
                }

                await departmentRepository.Insert(department);

                objHelper.Status  = StatusCodes.Status200OK;
                objHelper.Message = "Saved Successfully";
                objHelper.Data    = department;
                return(Ok(objHelper));
            }
            catch (Exception ex)
            {
                objHelper.Status  = StatusCodes.Status500InternalServerError;
                objHelper.Message = ex.Message;
                return(StatusCode(StatusCodes.Status500InternalServerError, objHelper));
            }
        }
        public async Task <IActionResult> UpdateStatus(int id, short isActive)
        {
            ResponseHelper objHelper = new ResponseHelper();

            if (!ModelState.IsValid)
            {
                objHelper.Status  = StatusCodes.Status424FailedDependency;
                objHelper.Message = ModelException.Errors(ModelState);
                return(BadRequest(objHelper));
            }
            try
            {
                await designationRepository.ToogleStatus(id, isActive);

                objHelper.Status  = StatusCodes.Status200OK;
                objHelper.Message = "Saved Successfully";
                return(Ok(objHelper));
            }
            catch (Exception ex)
            {
                objHelper.Status  = StatusCodes.Status500InternalServerError;
                objHelper.Message = ex.Message;
                return(StatusCode(StatusCodes.Status500InternalServerError, objHelper));
            }
        }
Ejemplo n.º 5
0
        //[ServiceFilter(typeof(ActionFilters.TokenVerify))]
        //[TypeFilter(typeof(ActionFilters.RolesValidate), Arguments = new object[] { "User", EnumPermission.Edit })]
        public IActionResult Edit(UserView user)
        {
            ResponseHelper objResHelper = new ResponseHelper();

            if (!ModelState.IsValid)
            {
                objResHelper.Status  = StatusCodes.Status424FailedDependency;;
                objResHelper.Message = ModelException.Errors(ModelState);
                return(BadRequest(objResHelper));
            }

            try
            {
                if (userRepository.UserExist(user))
                {
                    objResHelper.Status  = StatusCodes.Status208AlreadyReported;
                    objResHelper.Message = "Data already available";
                    return(Ok(objResHelper));
                }

                userRepository.UpdateUser(user);
                objResHelper.Data    = user;
                objResHelper.Status  = StatusCodes.Status200OK;
                objResHelper.Message = "Saved Successfully";

                return(Ok(objResHelper));
            }
            catch (Exception ex)
            {
                objResHelper.Status  = StatusCodes.Status500InternalServerError;
                objResHelper.Message = ex.Message;
                return(StatusCode(StatusCodes.Status500InternalServerError, objResHelper));
            }
        }
Ejemplo n.º 6
0
        //  [TypeFilter(typeof(ActionFilters.RolesValidate), Arguments = new object[] { "Category", EnumPermission.Add })]
        public async Task <IActionResult> Add(Ticket ticket)
        {
            ResponseHelper objHelper = new ResponseHelper();

            if (!ModelState.IsValid)
            {
                objHelper.Status  = StatusCodes.Status424FailedDependency;
                objHelper.Message = ModelException.Errors(ModelState);
                return(BadRequest(objHelper));
            }

            try
            {
                //if (ticketRepository.Exists(ticket))
                //{
                //    objHelper.Status = StatusCodes.Status200OK;
                //    objHelper.Message = "Data already available";
                //    return Ok(objHelper);
                //}

                var newticket = await ticketRepository.Insert(ticket);

                await ticketlogRepository.Insert(GetTicketLogFromTicket(newticket, "Inserted", ""));

                //string path = document.UploadFile(files, "E-913");

                objHelper.Status  = StatusCodes.Status200OK;
                objHelper.Message = "Saved Successfully";
                objHelper.Data    = ticket;
                return(Ok(objHelper));
            }
            catch (Exception ex)
            {
                objHelper.Status  = StatusCodes.Status500InternalServerError;
                objHelper.Message = ex.Message;
                return(StatusCode(StatusCodes.Status500InternalServerError, objHelper));
            }
        }