Esempio n. 1
0
        public ActionResult UpdateCandidatePhoto(string name, HttpPostedFileBase file)
        {
            if (file != null && file.ContentLength > 0)
            {
                var imgByte = new Byte[file.ContentLength];
                file.InputStream.Read(imgByte, 0, file.ContentLength);

                using (var candidateRepository = new CandidateRepository())
                {
                    candidateRepository.UpdateCandidatePhoto(Convert.ToInt32(name), imgByte, ElectionConductor.ElectionId((int)Session["UserId"]));
                }
            }
            return RedirectToAction("Index");
        }