public ActionResult Update([FromBody] BrandViewModel brand)
        {
            var currentRes = _bo.Read(brand.Id);

            if (!currentRes.Success)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError));
            }
            var current = currentRes.Result;

            if (current == null)
            {
                return(NotFound());
            }

            if (current.Name == brand.Name)
            {
                return(StatusCode((int)HttpStatusCode.NotModified));
            }

            if (current.Name != brand.Name)
            {
                current.Name = brand.Name;
            }


            var updateResult = _bo.Update(current);

            if (!updateResult.Success)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError));
            }
            return(Ok());
        }
        public void TestUpdateSameNameBrand()
        {
            ContextSeeder.Seed();
            var bo   = new BrandBusinessObject();
            var item = new Brand("Dona Ermelinda");

            bo.Create(item);
            item.Name = "Dona Edite";
            var resUpdate = bo.Update(item);

            Assert.IsTrue(!resUpdate.Result);
        }
        public void TestUpdateBrand()
        {
            ContextSeeder.Seed();
            var bo      = new BrandBusinessObject();
            var resList = bo.List();
            var item    = resList.Result.FirstOrDefault();

            item.Name = "It's just wine";
            var resUpdate  = bo.Update(item);
            var resNotList = bo.ListNotDeleted().Result;

            Assert.IsTrue(resUpdate.Success && resNotList.First().Name == "It's just wine");
        }