public ActionResult Create(ProjectManagement projectmanagement)
        {
            if (ModelState.IsValid)
            {
                if (Request.Files.Count > 0)
                {
                    try
                    {
                        var file = Request.Files[0];
                        if (file != null && file.ContentLength > 0)
                        {
                            string path = Path.Combine(Server.MapPath("~/Images/"),
                                                       Path.GetFileName(file.FileName));
                            file.SaveAs(path);
                            projectmanagement.UploadFile = path;
                            ViewBag.Message = "File uploaded successfully";
                        }
                    }
                    catch (Exception ex)
                    {
                        ViewBag.Message = "ERROR:" + ex.Message.ToString();
                    }
                }
            }
            {
                projectmanagement.UserId = WebSecurity.CurrentUserId;

                db.ProjectManagements.Add(projectmanagement);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(projectmanagement));
        }
Ejemplo n.º 2
0
        public ActionResult Create(ITAdmin itadmin)
        {
            var isExists     = db.UserProfiles.Any(_ => _.UserName == itadmin.UserName);
            var isEmailExits = db.ItAdmins.Any(_ => _.UserEmail == itadmin.UserEmail);

            if (isExists)
            {
                ViewBag.ErrorMessage = "User name already taken";
                return(View());
            }
            if (isEmailExits)
            {
                ViewBag.ErrorMessage = "Email address already taken";
                return(View());
            }

            WebSecurity.CreateUserAndAccount(itadmin.UserName, itadmin.DefaultPassword);
            itadmin.UserId = WebSecurity.CurrentUserId;
            itadmin.Id     = WebSecurity.GetUserId(itadmin.UserName);
            db.ItAdmins.Add(itadmin);
            db.SaveChanges();
            var userId =
                db.UserProfiles.Where(_ => _.UserName == itadmin.UserName).Select(_ => _.UserId).FirstOrDefault();

            Roles.AddUserToRole(itadmin.UserName, itadmin.Designation);

            return(RedirectToAction("Index"));
        }
 public void Post([FromBody] MovieModel value)
 {
     if (ModelState.IsValid)
     {
         _logger.LogDebug("movie Deleted...");
         _contex.Movies.Add(value);
         _contex.SaveChanges();
     }
 }
        public ActionResult EmployeeRegistration(int officeId)
        {
            var showEmpList = new EmpRegInfo()
            {
                EmpId = WebSecurity.CurrentUserId,
                OfficeId = officeId
            };
            _databaseContex.EmpRegInfos.Add(showEmpList);
            _databaseContex.SaveChanges();

            //Roles.AddUserToRole(WebSecurity.CurrentUserName,"Employee");

            return RedirectToAction("Index", "Home");

        }
        public ActionResult AssingTask(TaskAssign taskAssign)
        {
            var userId = WebSecurity.CurrentUserId;

            taskAssign.TaskAssignBy = userId;
            db.TaskAssigns.Add(taskAssign);
            db.SaveChanges();

            return(RedirectToAction("Index", "Home"));
        }
Ejemplo n.º 6
0
        public ActionResult Approve(int userId)
        {
            var employee = dbContex.EmpRegInfos.FirstOrDefault(_ => _.EmpId == userId);

            employee.IsAccept = true;
            dbContex.EmpRegInfos.AddOrUpdate(employee);
            dbContex.SaveChanges();

            var userName = dbContex.UserProfiles.Find(userId).UserName;

            Roles.AddUserToRole(userName, "Employee");
            return(RedirectToAction("PendingEmployees"));
        }
Ejemplo n.º 7
0
        public ActionResult ConfirmCallHistory(CallHistoryViewModel editedInfo)
        {
            var call = _databaseContex.CallRegistrations.Find(editedInfo.Id);

            if (call != null)
            {
                call.OrderCode    = editedInfo.OrderCode;
                call.CallerName   = editedInfo.CallerName;
                call.Address      = editedInfo.Address;
                call.Description  = editedInfo.Description;
                call.CallerEmail  = editedInfo.CallerEmail;
                call.AdminComment = editedInfo.AdminComment;

                //                call.OrderCode = editedInfo.OrderCode;
                //                call.ProductCode = editedInfo.ProductCode;
                //                call.ComplainType = editedInfo.ComplainType;
                //                call.QueryType = editedInfo.QueryType;
                //                call.PaymentMethod = editedInfo.PaymentMethod;
                //                call.DeliveryDate = editedInfo.DeliveryDate;
                //                call.CallTypeId = editedInfo.CallTypeId;
                //                call.CallingStatusId = editedInfo.CallingStatusId;
                //                call.OfficeOwnerId = editedInfo.OfficeOwnerId;
                //                call.JobCategoryId = editedInfo.JobCategoryId;

                _databaseContex.CallRegistrations.Attach(call);
                _databaseContex.Entry(call).State = EntityState.Modified;
            }
            _databaseContex.SaveChanges();

            string role = WebSecurity.CurrentUserName;

            if (Roles.IsUserInRole("Employee"))
            {
                return(RedirectToAction("MyCallHistory", "Employee"));
            }
            else
            {
                return(RedirectToAction("CallHistory", "Office"));
            }
        }