示例#1
0
 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());
     }
 }
示例#2
0
        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));
            }
        }
示例#4
0
 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);
         }
     }
 }
示例#5
0
        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());
            }
        }
示例#6
0
 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);
         }
     }
 }
示例#7
0
 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");
         }
     }
 }
示例#8
0
 public PermohonanContext(pemohon pemohon)
 {
     this.Pemohon = pemohon;
 }
 public ProfileViewModel(pemohon pemohon)
 {
     this.Profile = pemohon;
     SaveCommand  = new Command(SaveCommandAction);
 }