public permohonan GetPermohonan(pemohon pemohon, StatusPermohonan status) { using (var db = new OcphDbContext()) { return(db.Permohonans.Where(O => O.IdPemohon == pemohon.Id && O.Status == status).FirstOrDefault()); } }
public PermohonanService(pemohon t, IPermohonanUOW uow) { Pemohon = t; UnitWorkPermohonan = uow; var result = UnitWorkPermohonan.GetDaftarPermohonan(t); if (result.Count > 0) { Permohonan = result.Last(); } }
public async Task <IActionResult> Put(int id, [FromBody] pemohon value) { try { var service = new ClientService(); pemohon result = await service.UpdateProfile(value); return(Ok(result)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public bool CreatePemohon(pemohon item) { using (var db = new OcphDbContext()) { try { var result = db.Pemohons.Insert(item); return(result); } catch (Exception ex) { throw new SystemException(ex.Message); } } }
public List <permohonan> GetDaftarPermohonan(pemohon pemohon) { using (var db = new OcphDbContext()) { var results = from a in db.Permohonans.Where(O => O.IdPemohon == pemohon.Id) join b in db.Layanans.Select() on a.IdLayanan equals b.Id join c in db.Kategories.Select() on b.IdKategoriLayanan equals c.Id select new permohonan { Id = a.Id, IdLayanan = a.IdLayanan, IdPemohon = a.IdPemohon, Status = a.Status, Photo = a.Photo, Layanan = new layanan { Id = b.Id, IdKategoriLayanan = b.IdKategoriLayanan, Kategori = c, Nama = b.Nama } }; return(results.ToList()); } }
public Task <pemohon> UpdateProfile(pemohon value) { using (var db = new OcphDbContext()) { try { if (!db.Pemohons.Update(O => new { O.Alamat, O.Foto, O.Nama, O.NIK }, value, O => O.Id == value.Id)) { throw new SystemException("Data Tidak Tersimpan"); } return(Task.FromResult(value)); } catch (Exception ex) { throw new SystemException(ex.Message); } } }
public pemohon GetPemohon(int Id) { if (Id <= 0) { throw new SystemException("Id Tidak Boleh 0"); } else { pemohon result = UnitWorkPermohonan.GetPemohon(Id); if (result != null) { Pemohon = result; return(result); } else { throw new SystemException("Pemohon Tidak Ditemukan"); } } }
public PermohonanContext(pemohon pemohon) { this.Pemohon = pemohon; }
public ProfileViewModel(pemohon pemohon) { this.Profile = pemohon; SaveCommand = new Command(SaveCommandAction); }