/// <summary>
 /// Edits the specified p record identifier.
 /// </summary>
 /// <param name="pRecordId">The p record identifier.</param>
 /// <returns>ActionResult.</returns>
 public ActionResult Edit(int pRecordId)
 {
     var svc = new RecordAppService();
     var record = svc.GetRecord(pRecordId);
     var recordModel = new RecordViewModel
     {
         RecordId = record.RecordId,
         OperationName = record.OperationName,
         UserId = record.UserId,
         SessionId = record.SessionId,
         UserName = record.User.UserName,
         StartDate = record.StartDate,
         EndDate = record.EndDate,
         Message = record.Message,
         MessageCode = record.MessageCode,
         Parameters = record.XmlParameters
     };
     return View(recordModel);
 }
        public DataTablesResult<RecordViewModel> GetOperations(DataTablesParam dataTableParam)
        {

            var svc = new RecordAppService();
            var redords = svc.GetRecords(Convert.ToDateTime(Session["StartDate"].ToString()), Convert.ToDateTime(Session["EndDate"].ToString()).AddDays(1), Session["Operation"].ToString());
            var usersVm = new List<RecordViewModel>();

            foreach (var itm in redords)
            {

                var itmVm = new RecordViewModel
                {
                    RecordId = itm.RecordId,
                    OperationName = itm.OperationName,
                    UserId = itm.UserId,
                    SessionId = itm.SessionId,
                    UserName = itm.User.UserName,
                    StartDate = itm.StartDate,
                    EndDate = itm.EndDate,
                    Message = itm.Message,
                    MessageCode = itm.MessageCode

                };

                var sb = new StringBuilder();

                string editUrl = Url.Action("Edit", "Record");
                sb.AppendLine("<div class=\"btn-group\">");
                sb.AppendLine(
                    "<button type=\"button\" class=\"btn btn-default dropdown-toggle\" data-toggle=\"dropdown\" aria-expanded=\"false\">");
                sb.AppendLine("Acciones <span class=\"caret\"></span>");
                sb.AppendLine("</button>");
                sb.AppendLine("<ul class=\"dropdown-menu\" role=\"menu\">");
                sb.AppendLine("<li><a href=\"" + editUrl + "?pRecordId=" + itmVm.RecordId + "\"><i class=\"fa fa-edit\"></i>&nbsp;Ver detalle " + itmVm.OperationName + "</a></li>");
                sb.AppendLine("</ul>");
                sb.AppendLine("</div>");

                var actionButton = sb.ToString();

                itmVm.ActionButton = actionButton;
                usersVm.Add(itmVm);

            }

            var atVmQueryable = usersVm.AsQueryable();


            return DataTablesResult.Create(atVmQueryable, dataTableParam);
        }