コード例 #1
0
        public async Task <IActionResult> PutReport(int id, Report report)
        {
            if (id != report.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id,Title,CreatorId,ChannelId,CreateDate")] Conversation conversation)
        {
            if (ModelState.IsValid)
            {
                _context.Add(conversation);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CreatorId"] = new SelectList(_context.Users, "Id", "EMail", conversation.CreatorId);
            return(View(conversation));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("Id,UsersId,ParticipantsId,ReportType,Notes,CreateDate")] Report report)
        {
            if (ModelState.IsValid)
            {
                _context.Add(report);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ParticipantsId"] = new SelectList(_context.Participants, "Id", "Type", report.ParticipantsId);
            ViewData["UsersId"]        = new SelectList(_context.Users, "Id", "EMail", report.UsersId);
            return(View(report));
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("Id,ConversationId,MessageType,Message1,AttachmentThumbUrl,AttachmentUrl,CreateDate,UsersId")] Message message)
        {
            if (ModelState.IsValid)
            {
                _context.Add(message);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ConversationId"] = new SelectList(_context.Conversations, "Id", "ChannelId", message.ConversationId);
            ViewData["UsersId"]        = new SelectList(_context.Users, "Id", "EMail", message.UsersId);
            return(View(message));
        }
コード例 #5
0
        public async Task <IActionResult> Create([Bind("Id,ConversationId,UsersId,Type")] Participant participant)
        {
            if (ModelState.IsValid)
            {
                _context.Add(participant);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ConversationId"] = new SelectList(_context.Conversations, "Id", "ChannelId", participant.ConversationId);
            ViewData["UsersId"]        = new SelectList(_context.Users, "Id", "EMail", participant.UsersId);
            return(View(participant));
        }