public JsonResult Resimsil(List <string> values) { try { values.ForEach(path => { var yol = path.Substring(1); var foto = new FotografRepo().GetAll().Where(x => x.Yol == yol).FirstOrDefault(); new FotografRepo().Delete(foto); System.IO.File.Delete(Server.MapPath(path)); }); return(Json(new { success = true, message = "Seçili Resimler Silindi" }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { success = false, message = $"Resim Silme İşleminde Hata Var => {ex.Message}" }, JsonRequestBehavior.AllowGet)); } }
public ActionResult DestekTalepDetay(int id) { ViewBag.kategoriler = KategoriSelectList(); var ariza = new ArizaRepo().GetById(id); var fotograflar = new FotografRepo().WithByFaultId(id); var model = new KullaniciArizaDetayViewModel() { Ariza = ariza, FotografList = fotograflar }; return(View(model)); }
public async Task <IHttpActionResult> ArizaDetay(int id) { try { var ariza = new ArizaKayitRepo().GetById(id); // Her list olayını için böylemi yapmalı var fotolar = new FotografRepo().GetAll(x => x.ArizaId == ariza.Id).Select(x => x.Yol).ToList(); ariza.ArızaPath = fotolar; var data = new OperatorIndexViewModel { ArızaResim = ariza.ArızaPath, Adres = ariza.Adres, ArızaId = ariza.Id, MusteriId = ariza.MusteriId, FaturaResim = ariza.FaturaPath, telno = ariza.Telno, ArizaCreatedDate = ariza.CreatedDate, }; //arizadetaydata.ArızaPath = new FotografRepo().GetAll(z => z.ArizaId == id).Select(u => u.Yol).ToList(); if (data != null) { return(Ok(new ResponseData() { success = true, data = data })); } else { return(NotFound()); } } catch (Exception ex) { return(BadRequest($"Bir hata oluştu {ex.Message}")); } }
public async Task <IHttpActionResult> OPArizaDetay(int id) { try { var ariza = new ArizaKayitRepo().GetById(id); var fotolar = new FotografRepo().GetAll(x => x.ArizaId == ariza.Id).Select(x => x.Yol).ToList(); ariza.ArızaPath = fotolar; var data = new OperatorIndexViewModel { ArızaResim = ariza.ArızaPath, Adres = ariza.Adres, ArızaId = ariza.Id, MusteriId = ariza.MusteriId, FaturaResim = ariza.FaturaPath, telno = ariza.Telno, ArizaCreatedDate = ariza.CreatedDate, }; List <BosTeknisyenViewModel> TeknisyenList = new List <BosTeknisyenViewModel>(); var RoleTeknisyenler = NewRoleManager().FindByName("Teknisyen").Users.Select(x => x.UserId).ToList(); for (int i = 0; i < RoleTeknisyenler.Count; i++) { //var distance = 0.0; var distanceString = 0.0; var technician = NewUserManager().FindById(RoleTeknisyenler[i]); //if (technician.Enlem.HasValue && technician.Boylam.HasValue && model.Enlem.HasValue && model.Boylam.HasValue) //{ // var failureCoordinate = new GeoCoordinate(model.Enlem.Value, model.Boylam.Value); // var technicianCoordinate = new GeoCoordinate(technician.Enlem.Value, technician.Boylam.Value); // distance = failureCoordinate.GetDistanceTo(technicianCoordinate); // distanceString = distance / 1000; //} var calisiyormu = new ArizaKayitRepo().GetAll().FirstOrDefault(x => x.TeknisyenId == RoleTeknisyenler[i] && x.TeknisyenDurumu == TeknisyenDurumu.Calısıyor); if (calisiyormu == null) { TeknisyenList.Add(new BosTeknisyenViewModel() { Text = technician.Name + " " + technician.Surname + " " + "Arızaya Olan Mesafe" + " " + distanceString.ToString("##.000") + "Km", Value = technician.Id }); } } return(Ok(new ResponseData() { data = data, success = true, Teknisyenler = TeknisyenList })); } catch (Exception ex) { return(BadRequest($"Bir hata olustu{ex.Message}")); } }