コード例 #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));
        }
コード例 #3
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, "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"));
        }
コード例 #5
0
        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"));
        }