示例#1
0
        public ActionResult Create(vmFeedBack feedback)
        {
            FillFeedBackViewModel(feedback.InducteeID);
            if (ModelState.IsValid)
            {
                FeedbackModel dbFeedback = new FeedbackModel();
                PropertyModel Property   = new PropertyModel();
                if (feedback.Date != null)
                {
                    var Feedback = Convert.ToDateTime(feedback.Date);
                    dbFeedback.FeedbackDate = Feedback;
                }
                else
                {
                    dbFeedback.FeedbackDate = DateTime.Now;
                }

                dbFeedback.InducteeID = feedback.InducteeID;
                dbFeedback.TrainerId  = Convert.ToInt32(feedback.TrainerID);
                dbFeedback.InducteeID = feedback.InducteeID;

                Property.CommitmentComment    = feedback.Property.CommitmentComment;
                Property.CommitmentRating     = feedback.Property.CommitmentRating;
                Property.CommunicationComment = feedback.Property.CommunicationComment;
                Property.CommunicationRating  = feedback.Property.CommunicationRating;
                Property.DisciplineComment    = feedback.Property.DisciplineComment;
                Property.DisciplineRating     = feedback.Property.DisciplineRating;
                Property.EnergyComment        = feedback.Property.EnergyComment;
                Property.EnergyRating         = feedback.Property.EnergyRating;

                Property.FocusOnQualityComment = feedback.Property.FocusOnQualityComment;
                Property.FocusOnQualityRating  = feedback.Property.FocusOnQualityRating;

                Property.OwnerShipComment = feedback.Property.OwnerShipComment;
                Property.OwnerShipRating  = feedback.Property.OwnerShipRating;

                Property.PassionForClientSuccessComment = feedback.Property.PassionForClientSuccessComment;
                Property.PassionForClientSuccessRating  = feedback.Property.PassionForClientSuccessRating;
                Property.TeamPlayerComment          = feedback.Property.TeamPlayerComment;
                Property.TeamPlayerRating           = feedback.Property.TeamPlayerRating;
                Property.TechnicalCompetencyComment = feedback.Property.TechnicalCompetencyComment;
                Property.TechnicalCompetencyRating  = feedback.Property.TechnicalCompetencyRating;
                Property.TransparencyComment        = feedback.Property.TransparencyComment;
                Property.TransparencyRating         = feedback.Property.TransparencyRating;
                dbFeedback.Property = Property;

                if (FeedbackRepo.Create(dbFeedback) == true)
                {
                    ViewData["SuccessMsg"] = "Feedback saved successfully.";
                }
                else
                {
                    ViewData["ErrorMsg"] = "Failed to save feedback.";
                }
            }
            return(Redirect("/feedback/of/" + feedback.InducteeID));
        }