Exemple #1
0
        public ActionResult Create(EmployeeViewModel employeemodel)
        {
            try
            {
                EmployeeBAL employeebal = new EmployeeBAL();
                var         employeeDto = Mapper.Map <Employee>(employeemodel);

                if (ModelState.IsValid)
                {
                    employeebal.InsertEmployee(employeeDto);
                }

                CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
                    CloudConfigurationManager.GetSetting("StorageConnectionString"));
                CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();

                CloudQueue queue = queueClient.GetQueueReference("employeequeue");
                queue.CreateIfNotExists();
                CloudQueueMessage message =
                    new CloudQueueMessage(employeeDto.FName + " " + employeeDto.LName + " added to blob!");
                queue.AddMessage(message);

                return(RedirectToAction("List"));
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
Exemple #2
0
        public ActionResult Edit(EmployeeViewModel employeemodel)
        {
            try
            {
                EmployeeBAL employeebal = new EmployeeBAL();
                var         employeeDto = Mapper.Map <Employee>(employeemodel);

                if (ModelState.IsValid)
                {
                    employeebal.InsertEmployee(employeeDto);
                }

                return(RedirectToAction("List"));
            }
            catch (Exception ex)
            {
                return(View());
            }
        }