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.")); }
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")); }
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.")); }
public ActionResult Create(AddBatchDto addBatch) { new BatchRepository().Create(addBatch.RecipeId, addBatch.Cooker); return(RedirectToAction("Create")); }