public void ManageProductUserEmailAddressAlreadyExists()
        {
            var response = InitializeProductUserLogic.ManageProductUser(new ProductUserEntity
            {
                Product = new ProductEntity
                {
                    ProductCode = "BAR2017"
                },
                ProductUserCode = string.Empty,
                FirstName       = "Dhanaraj",
                LastName        = "D",
                EmailAddress    = "*****@*****.**",
                MobileNumber    = "9994304699"
            });

            Assert.IsTrue(!response.IsSuccess);
        }
Exemplo n.º 2
0
        public HttpResponseMessage ManageProductUser(ProductUserModel productUserModel)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(Request.CreateResponse(HttpStatusCode.BadRequest, ModelState));
                }

                var response = InitializeProductUserLogic.ManageProductUser(ConvertProductUserModelToEntity(productUserModel));
                return(Request.CreateResponse(response != null && !response.IsSuccess ? HttpStatusCode.OK : HttpStatusCode.BadRequest, ConvertProductUserEntityToProductUserModel(response)));
            }
            catch (Exception exception)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, exception));
            }
        }