Beispiel #1
0
        public async Task <ActionResult <nationality> > PostNationality(nationality nationality)
        {
            _context.nationality.Add(nationality);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("Getnationality", new { id = nationality.nationalityId }, nationality));
        }
 public ActionResult NationalityCreateEdit(nationality nationality)
 {
     result              = nationalityUtil.CreateEditNationality(nationality);
     ViewBag.Title       = nationality == null ? "Nationality Create" : "Nationality Edit";
     ViewBag.action_name = STUtil.GetListAllActionByController("");
     return(Json(result));
 }
Beispiel #3
0
        public async Task <IActionResult> PutNationality(int id, nationality nationality)
        {
            if (id != nationality.nationalityId)
            {
                return(BadRequest());
            }

            _context.Entry(nationality).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!nationalityExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public ActionResult NationalityIndex(string id)
        {
            STUtil.SetSessionValue(UserInfo.pageTitle.ToString(), "Nationality");
            nationality c = new nationality();

            if (id != null && id != "")
            {
                c = db.nationalities.Find(Convert.ToInt32(id));
            }

            return(View(c));
        }