示例#1
0
        public ActionResult OrganizationEdit(OrganizationModelview entity)
        {
            Organization org = _Orgrep.Find(entity.Id);

            #region Eski Resimleri Silmek için Yazdım
            string fullPath = Request.MapPath("~/Images/" + org.ImageUrl);
            if (System.IO.File.Exists(fullPath))
            {
                System.IO.File.Delete(fullPath);
            }
            #endregion


            org.Name        = entity.Name;
            org.Description = entity.Description;
            org.OrgDate     = entity.OrgDate;
            org.Place       = entity.Place;
            org.Organizer   = _userrep.Find(entity.Organizer_Id);

            org.ImageUrl = org.Name + "_" + org.Id + ".jpg";

            _Orgrep.Update(org);

            string imageway = ConfigurationManager.AppSettings["ImagePath"] + "/" + org.ImageUrl;

            Request.Files[0].SaveAs(imageway);


            return(RedirectToAction("Organizasyonlar"));
        }
示例#2
0
        public ActionResult OrganizasyonAdd(OrganizationModelview entity)
        {
            Organization org = new Organization();

            org.Name        = entity.Name;
            org.Description = entity.Description;
            org.OrgDate     = entity.OrgDate;
            org.Place       = entity.Place;
            org.Organizer   = _userrep.Find(entity.Organizer_Id);

            _Orgrep.Add(org);

            org.ImageUrl = org.Name + "_" + org.Id + ".jpg";

            _Orgrep.Update(org);

            string imageway = ConfigurationManager.AppSettings["ImagePath"] + "/" + org.ImageUrl;

            Request.Files[0].SaveAs(imageway);


            return(RedirectToAction("Organizasyonlar"));
        }