Пример #1
0
        public ActionResponseModel Post([FromBody] CompanyListModel value)
        {
            ActionResponseModel response = new ActionResponseModel();

            try
            {
                // Create News
                companyService.Create(value.ToDBModel());

                // Build Response
                response.Id      = value.Id;
                response.Success = true;
                response.Error   = null;
            }
            catch (Exception ex)
            {
                response.Id      = -1;
                response.Success = false;
                response.Error   = ex.Message;
            }
            return(response);
        }
Пример #2
0
        public ActionResponseModel Put(int id, [FromBody] CompanyListModel value)
        {
            ActionResponseModel response = new ActionResponseModel();

            try
            {
                // Update
                companyService.Update(id, value.ToDBModel());

                // Build Response
                response.Id      = id;
                response.Success = true;
                response.Error   = null;
            }
            catch (Exception ex)
            {
                response.Id      = -1;
                response.Success = false;
                response.Error   = ex.Message;
            }

            return(response);
        }