Exemplo n.º 1
0
        public HttpResponseMessage Put([FromBody] Models.area oArea)
        {
            try
            {
                if (_areaRepository.CheckDuplicateZoneArea(oArea))
                {
                    var formatter = RequestFormat.JsonFormaterString();
                    return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                        output = "error", msg = "Same Area and Zone Already Exists "
                    }, formatter));
                }
                else
                {
                    Models.area updateArea = new Models.area
                    {
                        region_id    = oArea.region_id,
                        area_id      = oArea.area_id,
                        area_name    = oArea.area_name,
                        area_code    = oArea.area_code,
                        is_active    = oArea.is_active,
                        updated_date = DateTime.Now,
                        updated_by   = oArea.updated_by
                    };

                    _areaRepository.EditArea(updateArea);


                    var formatter = RequestFormat.JsonFormaterString();
                    return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                        output = "success", msg = "Area Update Successfully"
                    }, formatter));
                }
            }
            catch (Exception ex)
            {
                var formatter = RequestFormat.JsonFormaterString();
                return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                    output = "error", msg = ex.ToString()
                }, formatter));
            }
        }