public async Task <IActionResult> Create([Bind("emp_id,emp_name,emp_role,emp_address,emp_city,emp_email,emp_password")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }
        public async Task <IActionResult> Create([Bind("city_name,State,city_pincode,branch_address")] City city)
        {
            if (new Utility(_accessor).IsAuthorisedAdmin())
            {
                if (ModelState.IsValid)
                {
                    _context.Add(city);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
                return(View(city));
            }
            return(Redirect("/Employee/Login"));
        }
Exemple #3
0
        public async Task <IActionResult> Create(String consignee_name, String city, String address, int pkg_weight_in_grams, String package_type, String package_content)
        {
            Consignment_Details details = new Consignment_Details();

            details.date                = DateTime.Now;
            details.Consignee_name      = consignee_name;
            details.destination_city    = city;
            details.address             = address;
            details.package_type        = package_type;
            details.pkg_weight_in_grams = pkg_weight_in_grams;
            cno++;
            details.consignment_no  = cno;
            details.user            = _accessor.HttpContext.Session.GetString("logged_in_user");
            details.package_content = package_content;
            details.amount          = 600.0F;

            Consignment_Status status = new Consignment_Status();

            status.consignment_no = details.consignment_no;
            status.date           = details.date;
            status.user           = details.user;
            status.consignee_name = details.Consignee_name;
            Console.WriteLine("consignment id: " + details);
            if (ModelState.IsValid)
            {
                _context.Add(details);
                _context.Add(status);
                await _context.SaveChangesAsync();

                return(Redirect("/User/Profile"));
            }
            else
            {
                return(Redirect("/User/Profile"));
            }
        }
Exemple #4
0
        public async Task <IActionResult> SignUpAsync(String email, String name, String password, String city, String phone_no, String address)
        {
            User U = new User();

            Console.Write(email + ":" + name + ":" + city + ":" + phone_no);
            Console.WriteLine("inside signup post method");
            U.email    = email;
            U.city     = city;
            U.name     = name;
            U.password = password;
            U.role     = "client";
            U.phone_no = phone_no;
            U.address  = address;
            if (ModelState.IsValid)
            {
                _context.Add(U);
                _ = await _context.SaveChangesAsync();

                return(Redirect("/Home/Index"));
            }
            return(View(U));
        }