Ejemplo n.º 1
0
 // 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")));
     }
 }
Ejemplo n.º 2
0
        public void CreateTag()
        {
            var tagCreate = new TagCreate();

            tagCreate.Ref     = "master";
            tagCreate.TagName = "my_test_tag";

            Assert.IsNotNull(repo.CreateTag(tagCreate));
        }
Ejemplo n.º 3
0
 public IActionResult New(TagCreate tagCreate)
 {
     if (ModelState.IsValid)
     {
         db.InsertTag(tagCreate.Name);
         return(RedirectToAction("Index", "Home"));
     }
     ViewBag.Name = tagCreate.Name;
     return(View(tagCreate));
 }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
            }
        }
Ejemplo n.º 6
0
        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));
        }
Ejemplo n.º 7
0
 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")));
     }
 }
Ejemplo n.º 8
0
        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")));
            }
        }
Ejemplo n.º 9
0
 public Tag CreateTag(TagCreate tag)
 {
     return(_api
            .Post().With(tag)
            .To <Tag>(_repoPath + "/tags"));
 }
Ejemplo n.º 10
0
 public Tag Create(TagCreate tag)
 {
     return(_api.Post().With(tag).To <Tag>(string.Format(TagsUrl, _repoPath)));
 }