コード例 #1
0
        public ActionResult Edit(Establishment establishment, HttpPostedFileBase image)
        {
            if (ModelState.IsValid)
            {
                if (image != null)
                {
                    establishment.ImageMimeType = image.ContentType;
                    establishment.ImageData     = new byte[image.ContentLength];
                    image.InputStream.Read(establishment.ImageData, 0, image.ContentLength);
                }

                _establishmentRepository.SaveEstablishment(establishment);
                // TODO: _establishmentRepository.Add(establishment);
                TempData["message"] = string.Format("Establishment {0} has been saved", establishment.Name);
                return(RedirectToAction("Index"));
            }
            else
            {
                // there is something wrong with the data values
                return(View(establishment));
            }
        }
コード例 #2
0
 public Establishment SaveEstablishment(Establishment mEstablishment)
 {
     return(establishmentRepository.SaveEstablishment(mEstablishment));
 }