重构代码:替换xml标注,设置属性为只读
This commit is contained in:
parent
7d577571a1
commit
4903e798c2
|
@ -15,7 +15,7 @@ namespace Bootstrap.Admin.Controllers
|
|||
/// <summary>
|
||||
/// 显示所有异常
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public QueryData<Exceptions> Get([FromUri]QueryExceptionOption value)
|
||||
|
|
|
@ -39,11 +39,11 @@ namespace Bootstrap.Admin.Controllers
|
|||
{
|
||||
return GroupHelper.SaveGroup(value);
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
[HttpDelete]
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
[HttpDelete]
|
||||
public bool Delete([FromBody]string value)
|
||||
{
|
||||
return GroupHelper.DeleteGroup(value);
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace Bootstrap.Admin.Controllers
|
|||
{
|
||||
if (string.IsNullOrEmpty(p.UserName) || string.IsNullOrEmpty(p.Password) || string.IsNullOrEmpty(p.DisplayName) || string.IsNullOrEmpty(p.Description)) return View();
|
||||
p.UserStatus = 1;
|
||||
return UserHelper.SaveUser(p) ? (ActionResult)base.Redirect("~/Content/html/RegResult.html") : View();
|
||||
return UserHelper.SaveUser(p) ? (ActionResult)Redirect("~/Content/html/RegResult.html") : View();
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
|
|
|
@ -4,6 +4,7 @@ using Longbow.Caching;
|
|||
using Longbow.Security.Principal;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Web.Http;
|
||||
using System.Web.Security;
|
||||
|
@ -24,8 +25,7 @@ namespace Bootstrap.Admin.Controllers
|
|||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="userName"></param>
|
||||
/// <param name="password"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
|
@ -36,7 +36,7 @@ namespace Bootstrap.Admin.Controllers
|
|||
string password = user.password;
|
||||
if (LgbPrincipal.Authenticate(userName, password) || BootstrapUser.Authenticate(userName, password))
|
||||
{
|
||||
var interval = int.Parse(Math.Round(FormsAuthentication.Timeout.TotalSeconds).ToString());
|
||||
var interval = int.Parse(Math.Round(FormsAuthentication.Timeout.TotalSeconds).ToString(CultureInfo.InvariantCulture));
|
||||
var token = CacheManager.AddOrUpdate(string.Format("WebApi-{0}", userName), interval, k => new LoginInfo() { UserName = userName, Token = Guid.NewGuid().ToString() }, (k, info) => info, "WebApi 数据缓存");
|
||||
CacheManager.AddOrUpdate(token.Token, interval, k => token, (k, info) => info, "Token 数据缓存");
|
||||
return token;
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Bootstrap.Admin.Controllers
|
|||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="value"></param>
|
||||
[HttpDelete]
|
||||
public bool Delete([FromBody]string value)
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Bootstrap.Admin.Controllers
|
|||
/// <summary>
|
||||
/// 根据Id返回不同的消息列表
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public IEnumerable<Message> Get(string id)
|
||||
|
@ -20,13 +20,17 @@ namespace Bootstrap.Admin.Controllers
|
|||
var ret = new List<Message>();
|
||||
switch (id)
|
||||
{
|
||||
case "inbox": ret = MessageHelper.Inbox(User.Identity.Name).ToList();
|
||||
case "inbox":
|
||||
ret = MessageHelper.Inbox(User.Identity.Name).ToList();
|
||||
break;
|
||||
case "sendmail": ret = MessageHelper.SendMail(User.Identity.Name).ToList();
|
||||
case "sendmail":
|
||||
ret = MessageHelper.SendMail(User.Identity.Name).ToList();
|
||||
break;
|
||||
case "mark": ret = MessageHelper.Mark(User.Identity.Name).ToList();
|
||||
case "mark":
|
||||
ret = MessageHelper.Mark(User.Identity.Name).ToList();
|
||||
break;
|
||||
case "trash": ret = MessageHelper.Trash(User.Identity.Name).ToList();
|
||||
case "trash":
|
||||
ret = MessageHelper.Trash(User.Identity.Name).ToList();
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
|
@ -35,16 +39,17 @@ namespace Bootstrap.Admin.Controllers
|
|||
/// <summary>
|
||||
/// 返回各个消息列表的文件个数
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public MessageCountModel Get()
|
||||
{
|
||||
MessageCountModel mcm = new MessageCountModel();
|
||||
mcm.inboxCount = MessageHelper.Inbox(User.Identity.Name).Count();
|
||||
mcm.sendmailCount = MessageHelper.SendMail(User.Identity.Name).Count();
|
||||
mcm.markCount = MessageHelper.Mark(User.Identity.Name).Count();
|
||||
mcm.trashCount = MessageHelper.Trash(User.Identity.Name).Count();
|
||||
var mcm = new MessageCountModel
|
||||
{
|
||||
InboxCount = MessageHelper.Inbox(User.Identity.Name).Count(),
|
||||
SendmailCount = MessageHelper.SendMail(User.Identity.Name).Count(),
|
||||
MarkCount = MessageHelper.Mark(User.Identity.Name).Count(),
|
||||
TrashCount = MessageHelper.Trash(User.Identity.Name).Count()
|
||||
};
|
||||
return mcm;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,10 +21,12 @@ namespace Bootstrap.Admin.Controllers
|
|||
{
|
||||
return value.RetrieveData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public IEnumerable<Role> Post(int id, [FromBody]JObject value)
|
||||
|
@ -47,9 +49,10 @@ namespace Bootstrap.Admin.Controllers
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>根据GroupID获取
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
public bool Put(int id, [FromBody]JObject value)
|
||||
|
@ -85,7 +88,7 @@ namespace Bootstrap.Admin.Controllers
|
|||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="value"></param>
|
||||
[HttpDelete]
|
||||
public bool Delete([FromBody]string value)
|
||||
{
|
||||
|
|
|
@ -4,8 +4,15 @@ using System.Web.Http;
|
|||
|
||||
namespace Bootstrap.Admin.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class TasksController : ApiController
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public IEnumerable<Task> Get()
|
||||
{
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace Bootstrap.Admin.Controllers
|
|||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="roleId"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
|
@ -73,7 +73,7 @@ namespace Bootstrap.Admin.Controllers
|
|||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="userName"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public User Get(string userName)
|
||||
|
@ -133,7 +133,7 @@ namespace Bootstrap.Admin.Controllers
|
|||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="value"></param>
|
||||
[HttpDelete]
|
||||
public bool Delete([FromBody]string value)
|
||||
{
|
||||
|
|
|
@ -14,17 +14,17 @@ namespace Bootstrap.Admin.Models
|
|||
Icon = user.Icon;
|
||||
DisplayName = user.DisplayName;
|
||||
UserName = user.UserName;
|
||||
UserID = user.ID;
|
||||
UserId = user.ID;
|
||||
}
|
||||
public string UserName { get; protected set; }
|
||||
public string UserName { get; private set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int UserID { get; protected set; }
|
||||
public int UserId { get; private set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string DisplayName { get; protected set; }
|
||||
public string DisplayName { get; private set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
@ -32,6 +32,6 @@ namespace Bootstrap.Admin.Models
|
|||
/// <summary>
|
||||
/// 获得/设置 用户头像地址
|
||||
/// </summary>
|
||||
public string Icon { get; set; }
|
||||
public string Icon { get; private set; }
|
||||
}
|
||||
}
|
|
@ -5,13 +5,6 @@
|
|||
/// </summary>
|
||||
public class LoginModel : ModelBase
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public LoginModel()
|
||||
{
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
|
|
@ -1,15 +1,25 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Bootstrap.Admin.Models
|
||||
namespace Bootstrap.Admin.Models
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class MessageCountModel
|
||||
{
|
||||
public int inboxCount { get; set; }
|
||||
public int sendmailCount { get; set; }
|
||||
public int markCount { get; set; }
|
||||
public int trashCount { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int InboxCount { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int SendmailCount { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int MarkCount { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int TrashCount { get; set; }
|
||||
}
|
||||
}
|
|
@ -7,6 +7,9 @@ namespace Bootstrap.Admin.Models
|
|||
/// </summary>
|
||||
public class ModelBase
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public ModelBase()
|
||||
{
|
||||
Title = DictHelper.RetrieveWebTitle();
|
||||
|
@ -15,8 +18,10 @@ namespace Bootstrap.Admin.Models
|
|||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Title { get; set; }
|
||||
|
||||
public string Footer { get; set; }
|
||||
public string Title { get; private set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Footer { get; private set; }
|
||||
}
|
||||
}
|
|
@ -27,10 +27,10 @@ namespace Bootstrap.Admin.Models
|
|||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public IEnumerable<Menu> Navigations { get; set; }
|
||||
public IEnumerable<Menu> Navigations { get; private set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public IEnumerable<KeyValuePair<string, string>> Applications { get; set; }
|
||||
public IEnumerable<KeyValuePair<string, string>> Applications { get; private set; }
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@ namespace Bootstrap.Admin.Models
|
|||
/// <summary>
|
||||
/// 获得/设置 头像文件大小
|
||||
/// </summary>
|
||||
public long Size { get; set; }
|
||||
public long Size { get; private set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<input id="userId" type="text" class="hidden" value="@Model.UserID" />
|
||||
<input id="userId" type="text" class="hidden" value="@Model.UserId" />
|
||||
}
|
||||
@section toolbar {
|
||||
<button id="btn_assignRole" type="button" class="btn btn-info">
|
||||
|
|
Loading…
Reference in New Issue