Esempio n. 1
0
        public IHttpActionResult Add([FromBody] TblSharedTestDto sharedTestDto)
        {
            var data = this.sharedTestService.GetByName(sharedTestDto.TestName, sharedTestDto.WebsiteId);

            if (!data.IsError)
            {
                data.Messages.Add(new Message(null, "Website already exists with '" + sharedTestDto.TestName + "' name!"));

                return(this.CreateCustomResponse(data, HttpStatusCode.BadRequest));
            }

            return(this.AddUpdate(sharedTestDto));
        }
Esempio n. 2
0
        /// <summary>
        /// Adds the update.
        /// </summary>
        /// <param name="sharedTestDto">The test dto.</param>
        /// <returns>
        /// Newly added object
        /// </returns>
        private IHttpActionResult AddUpdate(TblSharedTestDto sharedTestDto)
        {
            var result = new ResultMessage <TblSharedTestDto>();

            try
            {
                result = this.sharedTestService.SaveOrUpdate(sharedTestDto, this.UserId);
            }
            catch (Exception ex)
            {
                this.LoggerService.LogException(ex);
                result.Messages.Add(new Message(null, ex.Message));
            }

            return(this.CreateCustomResponse(result));
        }