public async Task <ActionResult> Create(ViewModels.PermohonanVM _permohonan) { if (ModelState.IsValid) { var currentdate = DateTime.UtcNow; var currentuser = await db.Users.Where(x => x.UserName == User.Identity.Name).SingleOrDefaultAsync(); var permohonankredit = new Permohonan() { Kode = "permohonan - " + currentuser.noktp, ktpimg = Helpers.FileHelperUpload.UploadKtp(_permohonan.Ktpimg), kkimg = Helpers.FileHelperUpload.UploadKK(_permohonan.Kkimg), skkerjaimg = Helpers.FileHelperUpload.UploadSKKerja(_permohonan.Skkerjaimg), tagihanlistrikimg = Helpers.FileHelperUpload.UploadTagihanListrik(_permohonan.Tagihanlistrikimg), Created = currentdate, CreatedBy = currentuser, status = status.Waiting }; db.Permohonan.Add(permohonankredit); var result = await db.SaveChangesAsync(); if (result > 0) { return(RedirectToAction("Index")); } } return(View(_permohonan)); }
public async Task <ActionResult> DeleteConfirmed(string id) { Permohonan permohonan = await db.Permohonan.FindAsync(id); db.Permohonan.Remove(permohonan); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "Idapprove,ktpimg,kkimg,skkerjaimg,tagihanlistrikimg,status,IsDeleted,Created,Updated,Deleted,Approved")] Permohonan permohonan) { if (ModelState.IsValid) { db.Entry(permohonan).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(permohonan)); }
public async Task <ActionResult> SurveyReject(int id) { var currentdate = DateTime.UtcNow; var currentuser = await db.Users.Where(x => x.UserName == User.Identity.Name).SingleOrDefaultAsync(); Permohonan permohonan = await db.Permohonan.FindAsync(id); permohonan.statussurvey = status.Rejected; db.Entry(permohonan).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("SurveyList")); }
// GET: ApprovalPermohonans/Edit/5 public async Task <ActionResult> Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Permohonan permohonan = await db.Permohonan.FindAsync(id); if (permohonan == null) { return(HttpNotFound()); } return(View(permohonan)); }
//approval syarat umum // POST: Permohonans/Approve/5 public async Task <ActionResult> Approve(int id) { var currentdate = DateTime.UtcNow; var currentuser = await db.Users.Where(x => x.UserName == User.Identity.Name).SingleOrDefaultAsync(); Permohonan permohonan = await db.Permohonan.FindAsync(id); permohonan.status = status.Accepted; permohonan.Approved = currentdate; permohonan.ApprovedBy = currentuser; db.Entry(permohonan).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); }