public IHttpActionResult PutNGO(int id, NGO nGO) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != nGO.NGO_Id) { return(BadRequest()); } db.Entry(nGO).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!NGOExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IActionResult> PutNGO(Guid id, NGO nGO) { if (id != nGO.ID) { return(BadRequest()); } _context.Entry(nGO).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NGOExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <NGOModel> > GetByID(Guid id) { NGO ngo = await applicationDbContext.NGOs.FindAsync(id); if (ngo == null) { return(NotFound()); } NGOModel ngoModel = new NGOModel { Id = ngo.ID, Name = ngo.Name, Status = ngo.NGOStatus, CreatedBy = applicationDbContext.Users.Find(ngo.CreatedByID.ToString()).Email, HeadquartersAddress = ngo.HeadquartersAddress, HeadquartersPhoneNumber = ngo.HeadquartersPhoneNumber, HeadquartersEmail = ngo.HeadquartersEmail, IdentificationNumber = ngo.IdentificationNumber, Website = ngo.Website, CategoryName = applicationDbContext.Categories.FirstOrDefault(c => c.ID == ngo.CategoryID)?.Name, ServiceName = applicationDbContext.Services.FirstOrDefault(c => c.ID == ngo.ServiceID)?.Name }; return(ngoModel); }
public async Task <ActionResult <NGO> > PostNGO(NGO nGO) { _context.NGOs.Add(nGO); await _context.SaveChangesAsync(); return(CreatedAtAction("GetNGO", new { id = nGO.ID }, nGO)); }
public ActionResult RaiseDonation() { string username = (string)Session["UserId"]; NGO ngo = db.NGOes.FirstOrDefault(n => n.Username == username); Verification verification = db.Verifications.Find(ngo.NId); if (verification != null) { if (verification.status.Equals("pending")) { return(RedirectToAction("Pending")); } if (verification.status.Equals("Rejected")) { return(RedirectToAction("Reject")); } if (verification.status.Equals("Verified")) { return(RedirectToAction("Donation")); } } else { return(RedirectToAction("verification", "NGO")); } return(View()); }
public IActionResult AddNGO(NgoViewModel viewModel) { var ngo = new NGO { NgoName = viewModel.NgoName, NgoAddress = viewModel.NgoAddress, NGOId = 0, work = viewModel.work, team = viewModel.team, facebookLink = viewModel.facebookLink, instagramLink = viewModel.instagramLink, phoneNumber = viewModel.phoneNumber, websiteLink = viewModel.websiteLink }; var uploadedImage = viewModel.imageUpload; if (uploadedImage.ContentType.ToLower().StartsWith("Image/")) { // var root = he.WebRootPath; // root = root + "\\SubmittedInitiativeImg"; ////same file name problems //var filename = Path.Combine(he.WebRootPath, Path.GetFileName(uploadedImage.FileName)); var name = Guid.NewGuid() + Path.GetFileName(uploadedImage.FileName); var filename = Path.Combine(he.WebRootPath, name); uploadedImage.CopyTo(new FileStream(filename, FileMode.Create)); ngo.filepath = "/" + name; } ngo.categoryId = viewModel.categoryId; ngo.Category = viewModel.Category; _dbContext.Add(ngo); _dbContext.SaveChanges(); return(Redirect(viewModel.returnUrl ?? "/Admin/NGOS")); }
public IHttpActionResult PostNGO(NGO nGO) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.NGOes.Add(nGO); db.SaveChanges(); return(CreatedAtRoute("route1", new { id = nGO.NGO_Id }, nGO)); }
public async Task <ActionResult <NGOModel> > VerifyByID(NGOModel ngoModel) { NGO ngo = await applicationDbContext.NGOs.FindAsync(ngoModel.Id); if (ngo != null) { ngo.NGOStatus = NGOStatus.Verified; ngoModel.Status = ngo.NGOStatus; await applicationDbContext.SaveChangesAsync(); } return(ngoModel); }
public IActionResult RegisterAsNGO() { Identity identity = ControllerContext.GetIdentity(); Volunteer volunteer = applicationDbContext.Volunteers.FirstOrDefault(x => x.ID == identity.ID && x.VolunteerStatus == VolunteerStatus.PendingVerification); Beneficiary beneficiary = applicationDbContext.Beneficiaries.FirstOrDefault(x => x.ID == identity.ID && x.Status == BeneficiaryStatus.PendingVerification); ViewBag.OtherPendingApplication = volunteer != null || beneficiary != null; NGO ngo = applicationDbContext.NGOs.FirstOrDefault(x => x.NGOStatus == NGOStatus.PendingVerification && x.CreatedByID == identity.ID); return(View(ngo)); }
public IHttpActionResult GetNGO(int id) { NGO ngo = db.NGOes.Find(id); if (ngo == null) { return(NotFound()); } DTO_NGO dngo = new DTO_NGO(); ngo.ConvertToDTO(dngo); return(Ok(dngo)); }
public ActionResult Details() { if (Session["UserId"] != null) { string username = (string)Session["UserId"]; NGO ngo = db.NGOes.FirstOrDefault(n => n.Username == username); return(View(ngo)); } else { return(RedirectToAction("Login", "Login")); } }
public ActionResult NGODetail() { string username = (string)Session["UserId"]; List <Verification> verified = db.Verifications.Where(n => n.status == "Verified").ToList(); NGO ngo = new NGO(); List <NGO> ngos = new List <NGO>(); foreach (Verification verify in verified) { ngo = db.NGOes.FirstOrDefault(n => n.NId == verify.Id); ngos.Add(ngo); } return(View(ngos)); }
public IHttpActionResult DeleteNGO(int id) { NGO nGO = db.NGOes.Find(id); if (nGO == null) { return(NotFound()); } db.NGOes.Remove(nGO); db.SaveChanges(); return(Ok(nGO)); }
public async Task <IActionResult> RaisedEvents(int id) { //List<NGO> ngoList = new List<NGO>(); using (var httpClient = new HttpClient()) { using (var response = await httpClient.GetAsync("http://localhost:14780/api/NGO/GetbyId/" + id)) { string apiResponse = await response.Content.ReadAsStringAsync(); //ViewBag.Result = "Success"; NGO ngoList = JsonConvert.DeserializeObject <NGO>(apiResponse); } } return(View()); }
public ActionResult Donation() { if (Session["UserId"] != null) { string username = (string)Session["UserId"]; NGO ngo = db.NGOes.FirstOrDefault(n => n.Username == username); Raisedonation raise = new Raisedonation(); raise.NId = ngo.NId; return(View(raise)); } else { return(RedirectToAction("Login", "Login")); } }
public ActionResult Register(NGO ngo) { if (ModelState.IsValid) { LoginDetail login = new LoginDetail(); login.Username = ngo.Username; login.Password = ngo.Password; login.LoginAs = "NGO"; db.LoginDetails.Add(login); db.NGOes.Add(ngo); db.SaveChanges(); return(RedirectToAction("Login", "Login")); } return(View()); }
public ActionResult Register() { NGO ng = new NGO(); NGO lastNgo = db.NGOes.OrderByDescending(n => n.NId).FirstOrDefault(); if (lastNgo == null) { ng.NId = "NG1"; } else { ng.NId = "NG" + (Convert.ToInt32(lastNgo.NId.Substring(2, lastNgo.NId.Length - 2)) + 1).ToString(); } return(View(ng)); }
public async Task <IActionResult> DeleteNgo(int id) { NGO ngo = new NGO(); using (var httpClient = new HttpClient()) { using (var response = await httpClient.GetAsync("http://localhost:14780/api/NGO/GetbyId/" + id)) { string apiResponse = await response.Content.ReadAsStringAsync(); ngo = JsonConvert.DeserializeObject <NGO>(apiResponse); } } return(View(ngo)); }
// GET: NGOs/Delete/5 public async Task <IActionResult> Delete(Guid?id) { if (id == null) { return(NotFound()); } NGO ngo = await applicationDbContext.NGOs.FirstOrDefaultAsync(m => m.ID == id); if (ngo == null) { return(NotFound()); } return(View(ngo)); }
public void mail(string Username, string trid) { Donation dn = db.Donations.Find(trid); Donar donar = db.Donars.FirstOrDefault(d => d.DId == dn.DId); NGO ngo = db.NGOes.FirstOrDefault(n => n.NId == dn.NgId); string subject = "Donation Receipt"; string body = "Hello " + donar.DName.ToUpperInvariant() + ",\nThank you for making donation for NGO.Here is the receipt of Donation you have made for your future references.\n\nAmount : Rs" + dn.Amount + "\n\n" + "Donar ID : " + donar.DId + "\n\n" + "NGO ID : " + ngo.NId + "\n\n" + "NGO Name : " + ngo.NgName + "\n\n" + "Transaction Id : " + trid + "\n\n" + "Transaction Date: " + dn.TransactionDate + "\n\n\n\n" + "Thank You"; SendEmail(Username, subject, body); }
public void mail(Verification verification) { NGO ngo = db.NGOes.Find(verification.Id); string subject = "Account Verification"; string vbody = "Hello, " + ngo.NgName + " your request for account verification to raise funds is accepted. You can now raise donations from donars from the website."; string rbody = "Hello, " + ngo.NgName + " your request for account verification to raise funds is rejected as documents uploaded by you were not clear. So,please resubmit your application with correct and valid documents. Thank You."; if (verification.status.Equals("Verified")) { SendEmail(ngo.Username, subject, vbody); } if (verification.status.Equals("Rejected")) { SendEmail(ngo.Username, subject, rbody); } }
public ActionResult verify() { string username = (string)Session["UserId"]; NGO ngo = db.NGOes.FirstOrDefault(n => n.Username == username); Verification verification = db.Verifications.Find(ngo.NId); if (verification == null) { return(RedirectToAction("verification")); } else { db.Verifications.Remove(verification); db.SaveChanges(); return(RedirectToAction("verification")); } }
public ActionResult Login(LoginDetail loginDetails) { if (ModelState.IsValid) { LoginDetail user = new LoginDetail(); user = db.LoginDetails.FirstOrDefault(u => u.Username == loginDetails.Username); if (user != null) { if (user.Username == loginDetails.Username && user.Password == loginDetails.Password) { Session["UserId"] = user.Username; if (user.LoginAs.Equals("Donar")) { Donar donar = db.Donars.FirstOrDefault(d => d.Username == user.Username); TempData["Dname"] = donar.DName; return(RedirectToAction("Index", "Donar")); } if (user.LoginAs.Equals("NGO")) { NGO ngo = db.NGOes.FirstOrDefault(n => n.Username == user.Username); TempData["Ngname"] = ngo.NgName; return(RedirectToAction("start", "NGO")); } if (user.LoginAs.Equals("Admin")) { return(RedirectToAction("Index", "Admin")); } } else { ViewBag.Message = "Invalid Password"; } return(View()); } else { ViewBag.Message = "User does not exist"; return(View()); } } return(View()); }
public async Task <IActionResult> RegisterAsNGO([Bind(nameof(NGO.Name))] NGO ngo) { if (ModelState.IsValid) { Identity identity = ControllerContext.GetIdentity(); ngo.ID = Guid.NewGuid(); ngo.CreatedByID = identity.ID; ngo.NGOStatus = NGOStatus.PendingVerification; applicationDbContext.Add(ngo); await applicationDbContext.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(ngo)); }
public ActionResult Donation(Raisedonation raisedonation) { if (ModelState.IsValid) { string username = (string)Session["UserId"]; NGO ngo = db.NGOes.FirstOrDefault(n => n.Username == username); Raisedonation donation = db.Raisedonations.FirstOrDefault(d => d.NId == ngo.NId); if (donation == null) { db.Raisedonations.Add(raisedonation); db.SaveChanges(); return(RedirectToAction("success")); } else { return(RedirectToAction("already")); } } return(View()); }
//public IActionResult Index() //{ // return View(); //} public async Task <IActionResult> Index(string name) { List <NGO> ngoList = new List <NGO>(); using (var httpClient = new HttpClient()) { // using (var response = await httpClient.GetAsync("http://localhost:14780/api/NGO")) { string apiResponse = await response.Content.ReadAsStringAsync(); ngoList = JsonConvert.DeserializeObject <List <NGO> >(apiResponse); } } NGO ngo = ngoList.FirstOrDefault(d => d.NgoUserName == name); TempData["ngoname"] = ngo.NgoName; TempData["ngoid"] = ngo.NgoId; return(View()); }
public async Task <IActionResult> Register(NGO ngo) { NGO nGO = new NGO(); using (var httpClient = new HttpClient()) { //int id = verify.VerificationId; StringContent content = new StringContent(JsonConvert.SerializeObject(ngo), Encoding.UTF8, "application/json"); using (var response = await httpClient.PostAsync("http://localhost:14780/api/NGO/NgoRegister", content)) { string apiResponse = await response.Content.ReadAsStringAsync(); //ViewBag.Result = "Success"; nGO = JsonConvert.DeserializeObject <NGO>(apiResponse); ViewBag.Result = "Successfully Registered, Please Login.....THANKYOU"; } } return(View()); }
public async Task <IActionResult> Edit(Guid?id) { if (id == null) { return(NotFound()); } NGO ngo = await applicationDbContext.NGOs.FindAsync(id); if (ngo == null) { return(NotFound()); } ngo.CreatedByName = applicationDbContext.Users.Find(ngo.CreatedByID.ToString()).Email; ViewBag.CategoryName = applicationDbContext.Categories.FirstOrDefault(c => c.ID == ngo.CategoryID)?.Name; ViewBag.ServiceName = applicationDbContext.Services.FirstOrDefault(s => s.ID == ngo.ServiceID)?.Name; return(View(ngo)); }
public IActionResult RegisterAsVolunteer() { Identity identity = ControllerContext.GetIdentity(); NGO ngo = applicationDbContext.NGOs.FirstOrDefault(x => x.CreatedByID == identity.ID && x.NGOStatus == NGOStatus.PendingVerification); Beneficiary beneficiary = applicationDbContext.Beneficiaries.FirstOrDefault(x => x.ID == identity.ID && x.Status == BeneficiaryStatus.PendingVerification); ViewBag.OtherPendingApplication = ngo != null || ngo != null; if (!ViewBag.OtherPendingApplication) { Volunteer volunteer = applicationDbContext.Volunteers.FirstOrDefault(x => x.VolunteerStatus == VolunteerStatus.PendingVerification && x.ID == identity.ID); volunteer.Name = applicationDbContext.Users.Find(identity.ID.ToString()).Email; return(View(volunteer)); } return(View()); }
public async Task <IActionResult> DeleteNgo(int id, NGO n) { NGO ngo = new NGO(); using (var httpClient = new HttpClient()) { // int id = verify.VerificationId; StringContent content = new StringContent(JsonConvert.SerializeObject(ngo), Encoding.UTF8, "application/json"); using (var response = await httpClient.DeleteAsync("http://localhost:14780/api/NGO/DeletebyId/" + id)) { string apiResponse = await response.Content.ReadAsStringAsync(); //ViewBag.Result = "Success"; ngo = JsonConvert.DeserializeObject <NGO>(apiResponse); } } return(RedirectToAction("Index")); }
protected void Button1_Click(object sender, EventArgs e) { NGO objNGO = new NGO(); // objNGO.NGOName = txtbrandname.Text; /* objNGO.NGOCategoryID= ddlcategory.SelectedValue; objNGO.Website = txtwebsite.Text; objNGO.NGODescription = txtdiscption.InnerText; objNGO.FacebookPage= facebook.Text; objNGO.TwitterPage = Twitter.Text; objNGO.YoutubeChannel = Youtube.Text; objNGO.GooglePlus = GooglePlus.Text; objNGO.Blog = Blog.Text; objNGO.Flicker = Flickr.Text; objNGO.FourSquareAccount = FoursquareAccount.Text; //objNGO.lindkin = LinkedIn.Text; string str= objNGO.CreateBransh(objNGO); */ }
void Awake() { _thisTransform = transform; _rb = GetComponent<Rigidbody>(); isNGOWaiting = false; if (instance == null) instance = this; }