public async Task <IActionResult> Create([Bind("ID,DoctorName,Specializare")] Doctor doctor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(doctor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(doctor));
        }
        public async Task <IActionResult> Create([Bind("CustomerID,Name,Adress,BirthDate")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
        public void CreateTeam(string name, string acronym, string description, string username)
        {
            var creator = context.Users.SingleOrDefault(p => p.Username == username);
            var team    = new Team
            {
                Name        = name,
                Acronym     = acronym,
                Description = description,
                Creator     = creator
            };

            context.Add(team);
            context.SaveChanges();
        }
        public void InviteUser(string teamName, string username)
        {
            var team = context.Teams.SingleOrDefault(p => p.Name == teamName);
            var user = context.Users.SingleOrDefault(p => p.Username == username);

            var invitation = new Invitation
            {
                Team        = team,
                InvitedUser = user,
                IsActive    = true
            };

            context.Add(invitation);
            context.SaveChanges();
        }
Beispiel #5
0
        public void CreateEvent(string name, string description, DateTime startDate, DateTime endDate,
                                string creatorName)
        {
            var creator = context.Users.SingleOrDefault(p => p.Username == creatorName);

            var @event = new Event
            {
                Name        = name,
                Description = description,
                StartDate   = startDate,
                EndDate     = endDate,
                Creator     = creator
            };


            context.Add(@event);
            context.SaveChanges();
        }