public ActionResult AssignOrganisation([Bind(Include = "ID, ID_product,ID_Organisation,Active,LastModified")] BusinessObjects.ProductOrganisation productorganisation)
        {
            var response = productmanager.SaveProductOrganisation(productorganisation);

            if (!response.IsError)
            {
                return(RedirectToAction("/ProductOrganizationList"));
            }

            else
            {
                ViewBag.ID_Organisation = new SelectList(OrganizationService.DropDownOrganisation(), "Id", "Name");
                ViewBag.ID_Product      = new SelectList(productmanager.DropDownProduct(), "Id", "Name_Prod");

                foreach (var failer in response.ValidationResult.Errors)
                {
                    ModelState.AddModelError(failer.PropertyName, failer.ErrorMessage);
                }
                return(View());
            }
        }
        public BugTrackingResponse <BusinessObjects.ProductOrganisation> SaveEditOrganization(BusinessObjects.ProductOrganisation prodorg)
        {
            Logger.TraceMethodStart(ClassName, "SaveEditOrganization");

            var response = new BugTrackingResponse <BusinessObjects.ProductOrganisation>();

            using (var db = new EntityModel.BugTrackingEntities())
            {
                using (var transaction = db.Database.BeginTransaction())
                {
                    try
                    {
                        var validator = new ProdOrganizationUpdateSpecification();
                        var result    = validator.Validate(prodorg);
                        var failures  = result.Errors;

                        response.ValidationResult = result;

                        if (result.IsValid)
                        {
                            prodorg.LastModified = DateTime.Now;
                            var newrole = MapperAllLevels.Map <BusinessObjects.ProductOrganisation, EntityModel.ProductOrganisation>(prodorg);
                            db.Entry(newrole).State = EntityState.Modified;
                            db.SaveChanges();
                            transaction.Commit();
                        }

                        else
                        {
                            transaction.Rollback();
                            Logger.TraceErrorFormat("Error while Saving {0}", response.ValidationResult.Errors);
                        }

                        return(response);
                    }

                    catch (Exception ex)
                    {
                        Logger.TraceError("Exception: ", ex);
                        transaction.Rollback();
                        throw;
                    }

                    finally
                    {
                        Logger.TraceMethodEnd(ClassName, "SaveEditOrganization");
                    }
                }
            }
        }