Exemplo n.º 1
0
        public async Task <ActionResult <Sexs> > PostSexs(Sexs sexs)
        {
            _context.Sexs.Add(sexs);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetSexs", new { id = sexs.SexId }, sexs));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> PutSexs(int id, Sexs sexs)
        {
            if (id != sexs.SexId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemplo n.º 3
0
 public Patient(int id, string name, string surname, double pesel, Sexs sex, DateTime birthDay, string address, string phoneNumber)
 {
     Id          = id;
     Name        = name;
     Surname     = surname;
     Pesel       = pesel;
     Sex         = sex;
     BirthDay    = birthDay.Date;
     Address     = address;
     PhoneNumber = phoneNumber;
 }
Exemplo n.º 4
0
        public static void Demo7()
        {
            Sex sex = Sex.Female;

            // 将一个字符串转换成枚举
            Sexs sex1 = (Sexs)Enum.Parse(typeof(Sexs), "男");

            Console.WriteLine(sex1);
            Console.ReadKey();

            // 枚举转字符串
            string sex2 = sex.ToString();

            Console.WriteLine(sex2);
            Console.ReadKey();
        }
Exemplo n.º 5
0
        public static void SetPersonnel(Personnel person, user item)
        {
            Sexs nSex = Sexs.未知;

            if (item.gender != null)
            {
                nSex = (Sexs)item.gender;
            }

            person.Abutment_Id = item.id;
            person.Name        = item.name;
            person.Sex         = nSex;
            person.Email       = item.email;
            person.Phone       = item.phone;
            person.Mobile      = item.mobile;
            person.Enabled     = item.enabled;
        }
Exemplo n.º 6
0
        private void AddPerson(string name, Sexs sex, LocationCard tag, Department dep, Post pst, int worknumber, string phone)
        {
            Personnel person = new Personnel()
            {
                Name       = name,
                Sex        = sex,
                Enabled    = true,
                ParentId   = dep.Id,
                WorkNumber = worknumber,
                Phone      = phone,
                Pst        = pst.Name
            };

            Personnels.Add(person);


            _bll.BindCardToPerson(person, tag);
        }
Exemplo n.º 7
0
        private void AddPerson(string name, Sexs sex, LocationCard tag, Department dep, Post pst, int worknumber, string phone)
        {
            Personnel person = new Personnel()
            {
                Name       = name,
                Sex        = sex,
                Enabled    = true,
                ParentId   = dep.Id,
                WorkNumber = worknumber,
                Phone      = phone,
                Pst        = pst.Name
            };

            Personnels.Add(person);


            if (tag != null && person != null)
            {
                LocationCardToPersonnel cardToPerson = new LocationCardToPersonnel();
                cardToPerson.PersonnelId    = person.Id;
                cardToPerson.LocationCardId = tag.Id;
                LocationCardToPersonnels.Add(cardToPerson);
            }
        }