public void CreateMark(MarkRecord markRecord)
        {
            string sqlQuery = @"INSERT INTO [dbo].[Rating]
                                           ([From]
                                           ,[To]
                                           ,[Value]
                                           ,[State]
                                           ,[Date])
                                     VALUES
                                           (@From,
                                           @To,
                                           @Value,
                                           @State,
                                           @Date)";

            var param = new
            {
                From = markRecord.From,
                To = markRecord.To,
                Value = JsonConvert.SerializeObject(markRecord.Marks),
                State = MarkState.Publish, // markRecord.Sate,
                Date = markRecord.DateCreated
            };

            using (DbConnection connection = connectionFactory.Create())
            {
                connection.Execute(sqlQuery, param);
            }
        }
        //        private string GetCurrentLogin()
        //        {
        //            return HttpContext.Request.LogonUserIdentity.Name.Split(new string[] { @"\\" }, StringSplitOptions.RemoveEmptyEntries)[0];
        //        }
        public ActionResult Save(string Name, Marks Marks)
        {
            if (Marks == null || !Marks.Validate())
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest, "Для оценки, отличной от S коментарий обязателен.");
            }

            try
            {
                var myLogin = GetCurrentLogin(); // UserNameHelper.GetUserName()
                var connector = new AdConnector();
                var user = connector.GetUserByLoginOrDefault(myLogin);
                var record = new MarkRecord
                {
                    DateCreated = DateTime.UtcNow,
                    From = user.Login,
                    Marks = Marks,
                    To = Name
                };
                repository.CreateMark(record);
                return Json("");
            }
            catch (Exception ex)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest, ex.Message);
            }
        }
 private object CreateReview(MarkRecord arg)
 {
     return new
     {
         Name = "User1",
         Marks = arg.Marks
     };
 }
 private object CreateReview(MarkRecord arg)
 {
     return new
     {
         From = arg.To,
         Time = arg.DateCreated,
         arg.Marks.Productivity,
         arg.Marks.Quality,
         arg.Marks.Discipline,
         arg.Marks.Cooperation,
     };
 }
 private object CreateReview(MarkRecord arg)
 {
     return new
     {
         arg.From,
         Time = arg.DateCreated,
         arg.Marks.Productivity,
         arg.Marks.Quality,
         arg.Marks.Discipline,
         arg.Marks.Cooperation,
         arg.Marks.Evolution,
         arg.Marks.ProfessionalSkills,
         arg.Marks.Initiative
     };
 }
        public void UpdateMark(MarkRecord markRecord)
        {
            string sqlQuery = @"UPDATE [dbo].[Rating]
                                   SET [Value] = @Value
                                      ,[State] = @State
                                      ,[Date] = @Date
                                 WHERE Id = @Id";

            var param = new
            {
                Id = markRecord.Id,
                Value = JsonConvert.SerializeObject(markRecord.Marks),
                State = markRecord.Sate,
                Date = markRecord.DateCreated
            };

            using (DbConnection connection = connectionFactory.Create())
            {
                connection.Execute(sqlQuery, param);
            }
        }