Ejemplo n.º 1
0
        public async Task <IActionResult> Index(Call model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _ctx.Add(model);
                    if (await _ctx.SaveChangesAsync() > 0)
                    {
                        ViewBag.Message = "Problem Reported...";
                        ModelState.Clear();
                    }
                    else
                    {
                        ViewBag.Message = "Failed to save new problem...";
                    }
                }
            }
            catch (Exception)
            {
                ViewBag.Message = "Threw exception trying to save call";
            }

            return(View());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("DesignationId,DesignationName,DesignationDetails,IsActive")] Designations designations)
        {
            if (ModelState.IsValid)
            {
                _context.Add(designations);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(designations));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("IndividualId,Nicnumber,PassportNumber,FullName,DateofBirth,GenderId,Address")] Individuals individuals)
        {
            if (ModelState.IsValid)
            {
                _context.Add(individuals);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GenderId"] = new SelectList(_context.Gender, "GenderId", "Gender1", individuals.GenderId);
            return(View(individuals));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("StaffId,IndividualId,DesignationId")] Staffs staffs)
        {
            if (ModelState.IsValid)
            {
                _context.Add(staffs);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DesignationId"] = new SelectList(_context.Designations, "DesignationId", "DesignationName", staffs.DesignationId);
            ViewData["IndividualId"]  = new SelectList(_context.Individuals, "IndividualId", "FullName", staffs.IndividualId);
            return(View(staffs));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Create([Bind("CallId,CallerIndividualId,CallAttendeeId,CallStateId,Date")] Calls calls)
        {
            if (ModelState.IsValid)
            {
                _context.Add(calls);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CallAttendeeId"]     = new SelectList(_context.Staffs, "StaffId", "StaffId", calls.CallAttendeeId);
            ViewData["CallStateId"]        = new SelectList(_context.States, "StateId", "Details", calls.CallStateId);
            ViewData["CallerIndividualId"] = new SelectList(_context.Individuals, "IndividualId", "Address", calls.CallerIndividualId);
            return(View(calls));
        }