public JsonResult UpdateSector(long sectorId, string sectorName)
        {
            if ((_sectorSvc.UpdateSector(sectorId, sectorName) == true))
            {
                return(Json("Success", JsonRequestBehavior.AllowGet));
            }

            return(Json("Failure", JsonRequestBehavior.AllowGet));
        }
        public IHttpActionResult UpdateSector(UpdateSectorRequest updateSectorRequest)
        {
            var responses = new Responses();

            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                if (Utility.UserId < 0)
                {
                    return(BadRequest(Utility.INVALID_USER));
                }

                var sector = new Sector()
                {
                    SectorId   = updateSectorRequest.SectorId,
                    Name       = updateSectorRequest.Name,
                    ModifiedBy = Utility.UserId
                };
                int result = iSector.UpdateSector(sector);

                switch (result)
                {
                case 1:
                    responses.Status      = Utility.SUCCESS_STATUS_RESPONSE;
                    responses.Description = "Sector updated successfully.";
                    break;

                case -2:
                    responses.Status      = Utility.ERROR_STATUS_RESPONSE;
                    responses.Description = "Sector already exists.";
                    break;

                case -3:
                    responses.Status      = Utility.ERROR_STATUS_RESPONSE;
                    responses.Description = "Sector doesn't exist.";
                    break;

                default:
                    responses.Status      = Utility.ERROR_STATUS_RESPONSE;
                    responses.Description = "Error while updating sector.";
                    break;
                }
            }
            catch (Exception ex)
            {
                responses.Status      = Utility.ERROR_STATUS_RESPONSE;
                responses.Description = "Error while updating admin profile.";

                Utility.WriteLog("UpdateSector", updateSectorRequest, "Error while updating sector. (SectorAdminController)", ex.ToString());
            }
            return(Ok(responses));
        }