Example #1
0
        public ActionResult AVMEkle(AVM avm, List <HttpPostedFileBase> image)
        {
            Resim _resim;

            foreach (var item in image)
            {
                _resim = new Resim();
                var extension = Path.GetExtension(item.FileName);
                if (image != null && (extension == ".jpg" || extension == ".png" || extension == ".jpeg"))
                {
                    var path           = Server.MapPath("~/UploadImages");
                    var RandomFileName = Path.GetRandomFileName();
                    var Name           = Path.ChangeExtension(RandomFileName, ".jpg");
                    var final          = Path.Combine(path, Name);
                    item.SaveAs(final);
                    _resim.Ad = Name;
                    avm.Resim.Add(_resim);
                }
            }
            _avm.PostAVM(avm);

            ViewBag.Ekleme = "true";
            return(View("AVMIslem", _avm.GetAVMs()));
        }
Example #2
0
 public IHttpActionResult PostAVM(AVM avm)
 {
     avmRep.PostAVM(avm);
     return(Ok("Ekleme İşlemi Başarılı"));
 }