コード例 #1
0
        public ActionResult AddNewOtherTest(OtherTestDto otherTestDto)
        {
            if (otherTestDto != null)
            {
                var otherTest = otherTestDto.GetOtherTest(otherTestDto);
                if (otherTest != null)
                {
                    try
                    {
                        testsService.InsertOtherTest(otherTest);
                    }
                    catch (Exception e)
                    {
                        Program.Logger.Error(e);
                        return(Ok(GetResponse(ResponseType.FAIL, ResponseStatusCode.FAIL, GetError(ErrorCodes.dataNotFound, "Failed", "Error occurred while creating new other test"))));
                    }

                    return(Ok(GetResponse(ResponseType.ACK, ResponseStatusCode.SUCCESS)));
                }
                else
                {
                    return(Ok(GetResponse(ResponseType.FAIL, ResponseStatusCode.FAIL, GetError(ErrorCodes.dataNotFound, "Failed", "Something went wrong."))));
                }
            }
            else
            {
                return(BadRequest(GetResponse(ResponseType.ERROR, ResponseStatusCode.ERROR, GetError(ErrorCodes.invalidData, "Invalid input", "Please enter proper other test details"))));
            }
        }