// GET: Attachments/Delete/5 public ActionResult Delete(int?id, int?applicantId) { if (Request.IsAuthenticated) { try { if (id == null || applicantId == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ApplicantWeb.Models.Applicant applicant = db.Applicants.Find(applicantId); if (applicant == null) { return(HttpNotFound()); } TagCreate tagCreate = new TagCreate() { TagId = db.Tags.Find(id).TagId, TagName = db.Tags.Find(id).TagName, ApplicantId = applicant.ApplicantId, Applicant = applicant }; if (tagCreate == null) { return(HttpNotFound()); } return(PartialView("PartialDelete", tagCreate)); } catch { return(HttpNotFound()); } } else { return(Redirect(Url.Action("Login", "Account"))); } }
public void CreateTag() { var tagCreate = new TagCreate(); tagCreate.Ref = "master"; tagCreate.TagName = "my_test_tag"; Assert.IsNotNull(repo.CreateTag(tagCreate)); }
public IActionResult New(TagCreate tagCreate) { if (ModelState.IsValid) { db.InsertTag(tagCreate.Name); return(RedirectToAction("Index", "Home")); } ViewBag.Name = tagCreate.Name; return(View(tagCreate)); }
public void InitTags() { TagFields = new TagFields("Asp.net"); Tag1 = new Tag(TagFields); Applicants = new List <ApplicantWeb.Models.Applicant>(); Applicant = new ApplicantWeb.Models.Applicant(); Applicants.Add(Applicant); Tag2 = new Tag(TagFields, Applicants); TagCreate = new TagCreate(TagFields, Applicant.ApplicantId); }
public bool CreateTag(TagCreate model) { var entity = new Tag() { OwnerId = _userId, TagManufacturer = model.TagManufacturer, TagModel = model.TagModel, TagSerialNumber = model.TagSerialNumber }; using (var ctx = new ApplicationDbContext()) { ctx.Tag.Add(entity); return(ctx.SaveChanges() == 1); } }
public ActionResult Create(TagCreate model) { if (!ModelState.IsValid) { return(View(model)); } var service = CreateTagService(); if (service.CreateTag(model)) { TempData["SaveResult"] = "Your Tag was Created."; return(RedirectToAction("Index")); } ; ModelState.AddModelError("", "Tag could not be created."); return(View(model)); }
public ActionResult Create(TagCreate tagCreate) { if (Request.IsAuthenticated) { try { db.CreateTagAndAddTagInApplicant(tagCreate); return(PartialView("PartialList", new TagList() { ApplicantId = tagCreate.ApplicantId, Tags = db.ToList(tagCreate.ApplicantId) })); } catch { return(HttpNotFound()); } } else { return(Redirect(Url.Action("Login", "Account"))); } }
public ActionResult DeleteConfirmed(TagCreate tagCreate) { if (Request.IsAuthenticated) { try { db.DeleteTag(tagCreate); db.SaveChanges(); return(PartialView("PartialList", new TagList() { Tags = db.ToList(tagCreate.ApplicantId), ApplicantId = tagCreate.ApplicantId })); } catch { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } } else { return(Redirect(Url.Action("Login", "Account"))); } }
public Tag CreateTag(TagCreate tag) { return(_api .Post().With(tag) .To <Tag>(_repoPath + "/tags")); }
public Tag Create(TagCreate tag) { return(_api.Post().With(tag).To <Tag>(string.Format(TagsUrl, _repoPath))); }