Пример #1
0
 public IActionResult Post(Person person)
 {
     if (_peopleService.Validated(person))
     {
         _peopleService.Create(person);
         return(new CreatedAtRouteResult(nameof(this.Get), person.Id));
     }
     return(new BadRequestResult());
 }
Пример #2
0
 public IActionResult Create(Person person)
 {
     if (ModelState.IsValid)
     {
         _service.Create(person);
         return(RedirectToAction("Index"));
     }
     return(View(person));
 }
Пример #3
0
        public async Task <IActionResult> Create([Bind("PrivateNo,FirstName,LastName,BirthDate,Phone,Profession")] PersonModel person)
        {
            if (ModelState.IsValid)
            {
                await _ps.Create(person);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(person));
        }
        public IActionResult Create(string name, string city, string phone)
        {
            Person person = _peopleService.Create(name, city, phone);

            if (person == null)
            {
                return(BadRequest(new { msg = "All inputs must have a value." }));
            }

            return(PartialView("_Person", person));
        }
Пример #5
0
        public ActionResult Create([Bind("ixPerson,sPerson,sFirstName,sLastName,ixLanguage")] PeoplePost people)
        {
            if (ModelState.IsValid)
            {
                people.UserName = User.Identity.Name;
                _peopleService.Create(people);
                return(RedirectToAction("Index"));
            }
            ViewBag.ixLanguage = new SelectList(_peopleService.selectLanguages().Select(x => new { x.ixLanguage, x.sLanguage }), "ixLanguage", "sLanguage");

            return(View(people));
        }
Пример #6
0
        public ActionResult Create(PersonViewModel person)//need to have zero constructor for this binding to work
        {
            if (ModelState.IsValid)
            {
                _peopleService.Create(person);

                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                return(View(person));
            }
        }
        public ActionResult Create(PersonViewModel person)//need to have zero constructor for this binding to work
        {
            if (ModelState.IsValid)
            {
                People createdPeople = _personService.Create(person);

                return(PartialView("_drinkPartial", createdPeople));
            }
            else
            {
                return(BadRequest());
            }
        }
Пример #8
0
        public IActionResult Create(string name, string phone, string city)
        {
            if (name == null)
            {
                return(BadRequest(new { msg = "You most write name" }));
            }
            if (city == null)
            {
                return(BadRequest(new { msg = "You most write a City" }));
            }
            if (phone == null)
            {
                return(BadRequest(new { msg = "You most write yor phonenumber" }));
            }

            Person person = _peopleService.Create(name, phone, city);

            return(PartialView("_Person", person));
            //return RedirectToAction("Filter");
        }
Пример #9
0
 public void Create(People people)
 {
     _peopleService.Create(people);
 }
 public void Create(People people, string[] apps)
 {
     _peopleService.Create(people, apps);
 }
Пример #11
0
        public async Task <PeopleDto> Create(PeopleDto peopleDto)
        {
            PeopleDto result = await peopleService.Create(peopleDto);

            return(result);
        }
Пример #12
0
        public IEnumerable <string> Post(Person person)
        {
            _peopleService.Create(person);

            return(_peopleService.GetAllPeople().Select(p => p.Name));
        }