예제 #1
0
        public HttpResponseMessage AddBatch(AddBatchDto addBatch)
        {
            var repository = new BatchRepository();
            var result     = repository.Create(addBatch.RecipeId, addBatch.Cooker);

            return((result)
                ? Request.CreateResponse(HttpStatusCode.Created)
                : Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Could not create recipe. Please try again."));
        }
예제 #2
0
        public ActionResult Create()
        {
            var recipes   = new RecipeRepository().GetAll();
            var viewModel = new AddBatchDto {
                Recipes = recipes.Select(x => new SelectListItem {
                    Text = x.name, Value = x.Id.ToString()
                })
            };

            return(View(viewModel));
        }
        public HttpResponseMessage AddBatch(AddBatchDto addBatch)
        {
            var repository = new BatchRepository();
            var result     = repository.Create(addBatch.RecipeId, addBatch.Cooker);

            if (result)
            {
                return(Request.CreateResponse(HttpStatusCode.Created));
            }

            return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Sorry about your luck, shmuck"));
        }
예제 #4
0
        public HttpResponseMessage AddBatch(AddBatchDto addBatch)
        {
            var repository = new BatchRepository();
            var result     = repository.Create(addBatch.RecipeId, addBatch.Cooker);

            if (result)
            {
                return(Request.CreateResponse(HttpStatusCode.Created));
            }
            ;

            return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Could not create batch"));
        }
        public HttpResponseMessage AddBatch(AddBatchDto addBatch)
        {
            var batchRepository = new BatchRepository();
            var createBatch     = batchRepository.Create(addBatch.RecipeId, addBatch.Cooker);


            if (createBatch)
            {
                return(Request.CreateResponse(HttpStatusCode.Created));
            }

            return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Sorry we could not create a batch at this time, please try again later."));
        }
예제 #6
0
        public ActionResult Create(AddBatchDto addBatch)
        {
            new BatchRepository().Create(addBatch.RecipeId, addBatch.Cooker);

            return(RedirectToAction("Create"));
        }