public ActionResult Create(FindingCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            HttpPostedFileBase file = Request.Files["ImageData"];
            var service             = new FindingService();

            if (service.CreateFinding(model))
            {
                TempData["SaveResult"] = "Your finding was added.";
                return(RedirectToAction("Index"));
            }
            ;
            ModelState.AddModelError("", "Finding could not be added.");

            return(View(model));
        }
        public bool CreateFinding(FindingCreate model)
        {
            var entity = new Finding()
            {
                Category    = model.Category,
                SubType     = model.SubType,
                Size        = model.Size,
                Color       = model.Color,
                Association = model.Association,
                Quantity    = model.Quantity,
                Cost        = model.Cost,
                LocationId  = model.LocationId,
                SourceId    = model.SourceId,
                Description = model.Description,
                File        = _FileService.ConvertToBytes(model.File),
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Findings.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }