Esempio n. 1
0
        public HumanModel Post([FromBody] NewHumanModel value)
        {
            var result = new HumanModel(value.Name);

            _humans.Add(result);

            return(result);
        }
Esempio n. 2
0
        public BaseApiResponse <FullNameDeclension> Declension([FromForm] HumanModel model)
        {
            if (model == null)
            {
                return(null);
            }

            return(FullNameDeclension.GetByHumanModel(model));
        }
Esempio n. 3
0
        public ActionResult SaveHumanInfo(int id, string name, string surname,
                                          string gender, int age, decimal phone)
        {
            HumanModel myObj = new HumanModel();

            myObj.ID      = id;
            myObj.Name    = name;
            myObj.Surname = surname;
            myObj.Gender  = gender;
            myObj.Age     = age;
            myObj.Phone   = phone;
            return(View("About", myObj));
        }
Esempio n. 4
0
        public ActionResult About()
        {
            HumanModel myObj = new HumanModel();

            myObj.ID      = 1;
            myObj.Name    = "Sarawoot";
            myObj.Surname = "Thongchan";
            myObj.Gender  = "Male";
            myObj.Age     = 34;
            myObj.Phone   = 66851261221;


            return(View(myObj));
        }
Esempio n. 5
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            HumanModel = await _context.HumanModel.FirstOrDefaultAsync(m => m.Id == id);

            if (HumanModel == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Esempio n. 6
0
        public ActionResult Contact()
        {
            HumanModel        someone = new HumanModel();
            List <HumanModel> result  = new List <HumanModel>();

            try
            {
                result = someone.getSomeone("S", 1, 40);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(View(result));
        }
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            HumanModel = await _context.HumanModel.FindAsync(id);

            if (HumanModel != null)
            {
                _context.HumanModel.Remove(HumanModel);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Esempio n. 8
0
        private static FullNameDeclension GetFullNameDeclensionByHuman(HumanModel human)
        {
            var declensionInMemory = HumanWithDeclensions.FirstOrDefault(x =>
                                                                         x.Human.FirstName == human.FirstName && x.Human.LastName == human.LastName &&
                                                                         x.Human.Patronymic == human.Patronymic);

            if (declensionInMemory != null)
            {
                return(declensionInMemory.Declension);
            }

            declensionInMemory = new HumanWithFullNameDeclension
            {
                Human = human
            };

            HumanWithDeclensions.Add(declensionInMemory);

            return(GetFullNameDeclensionByHuman(human));
        }
Esempio n. 9
0
        // GET: Saraw
        public ActionResult Index()
        {
            string[] arrayData = new string[] { "Name", "Age", "Height", "weight" };
            //-------------
            List <HumanModel> humanData = new List <HumanModel>();

            humanData.Add(new HumanModel());
            humanData[0].human = new string[4] {
                "Name", "Age", "Height", "weight"
            };
            humanData.Add(new HumanModel());
            humanData[1].human = new string[4] {
                "Sarawoot", "34", "175", "66"
            };
            humanData.Add(new HumanModel());
            humanData[2].human = new string[4] {
                "Budsaba", "32", "150", "40"
            };
            humanData.Add(new HumanModel());
            humanData[3].human = new string[4] {
                "Bhubodin", "1.2", "76", "11"
            };

            ViewData["arrayData"] = arrayData;
            ViewData["humanData"] = humanData;
            ViewBag.humanData     = humanData;
            //------------------

            //------human from data base
            HumanModel model = new HumanModel(true);

            ViewBag.humanDB = model.HumanList;
            //------human from data base

            return(View(humanData));
        }
Esempio n. 10
0
        public void Create(HumanModel model)
        {
            var entity = _mapper.Map <Human>(model);

            _humansRepository.Create(entity);
        }
Esempio n. 11
0
        /// <summary>
        /// Склонение Отчества человека
        /// </summary>
        /// <param name="human"></param>
        /// <param name="wordCase"></param>
        /// <returns></returns>
        public static string PatronymicDeclension(HumanModel human, WordCase wordCase)
        {
            var fullNameDecl = GetFullNameDeclensionByHuman(human);

            return(fullNameDecl.Patronymic.GetByWordCase(wordCase));
        }
Esempio n. 12
0
        /// <summary>
        /// Склонение фамилии человека
        /// </summary>
        /// <param name="human"></param>
        /// <param name="wordCase"></param>
        /// <returns></returns>
        public static string LastNameDeclension(HumanModel human, WordCase wordCase)
        {
            var fullNameDecl = GetFullNameDeclensionByHuman(human);

            return(fullNameDecl.LastName.GetByWordCase(wordCase));
        }
 public HumanModelEvaluater(HumanModel humanModel, float limitTime)
 {
     _humanModel = humanModel;
     _limitTime  = limitTime;
 }